summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-12-29 05:47:52 (EST)
committerEike Stepper2007-12-29 05:47:52 (EST)
commite35086970836ae2ceb12158e5d0e3aab5b9a20cc (patch)
treec7cd7b82b9e8c0f2a86555c630435ebe53f117ea
parent50caeeda2025930b254abae263b03066cec15649 (diff)
downloadcdo-e35086970836ae2ceb12158e5d0e3aab5b9a20cc.zip
cdo-e35086970836ae2ceb12158e5d0e3aab5b9a20cc.tar.gz
cdo-e35086970836ae2ceb12158e5d0e3aab5b9a20cc.tar.bz2
[213782] Transaction DeadLock
https://bugs.eclipse.org/bugs/show_bug.cgi?id=213782
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java13
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Channel.java72
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannel.java6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannelID.java29
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/IConnector.java12
5 files changed, 23 insertions, 109 deletions
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
index 337e7a4..4dc00f9 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
@@ -19,7 +19,6 @@ import org.eclipse.net4j.tests.signal.TestSignalClientProtocolFactory;
import org.eclipse.net4j.tests.signal.TestSignalProtocol;
import org.eclipse.net4j.tests.signal.TestSignalServerProtocolFactory;
import org.eclipse.net4j.util.container.IManagedContainer;
-import org.eclipse.net4j.util.om.OMPlatform;
import java.util.Arrays;
@@ -58,16 +57,16 @@ public class SignalTest extends AbstractTransportTest
public void testAsync() throws Exception
{
startTransport();
- OMPlatform.INSTANCE.setDebugging(false);
+ // OMPlatform.INSTANCE.setDebugging(false);
IChannel channel = getConnector().openChannel(TestSignalProtocol.PROTOCOL_NAME, null);
- String tiny = TinyData.getText();
- String huge = HugeData.getText();
+ String data = TinyData.getText();
+ // String huge = HugeData.getText();
for (int i = 0; i < 10000; i++)
{
msg("Loop " + i);
- new AsyncRequest(channel, tiny).send();
- String result = new StringRequest(channel, huge).send();
- assertEquals(huge, result);
+ new AsyncRequest(channel, data).send();
+ String result = new StringRequest(channel, data).send();
+ assertEquals(data, result);
}
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Channel.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Channel.java
index f176b60..66ec23b 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Channel.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Channel.java
@@ -15,19 +15,15 @@ import org.eclipse.net4j.IBuffer;
import org.eclipse.net4j.IBufferHandler;
import org.eclipse.net4j.IBufferProvider;
import org.eclipse.net4j.IChannel;
-import org.eclipse.net4j.IChannelID;
-import org.eclipse.net4j.IConnector;
import org.eclipse.net4j.internal.util.concurrent.QueueWorkerWorkSerializer;
import org.eclipse.net4j.internal.util.concurrent.SynchronousWorkSerializer;
import org.eclipse.net4j.internal.util.lifecycle.Lifecycle;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
-import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.concurrent.IWorkSerializer;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.internal.net4j.bundle.OM;
-import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -146,7 +142,7 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
public void handleBuffer(IBuffer buffer)
{
- BufferState state = ((Buffer)buffer).getState();
+ BufferState state = buffer.getState();
if (state != BufferState.PUTTING)
{
OM.LOG.warn("Ignoring buffer in state == " + state + ": " + this); //$NON-NLS-1$ //$NON-NLS-2$
@@ -228,14 +224,17 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
// receiveSerializer = new CompletionWorkSerializer();
// receiveSerializer = new AsynchronousWorkSerializer(receiveExecutor);
// receiveSerializer = new SynchronousWorkSerializer();
- receiveSerializer = new QueueWorkerWorkSerializer()
+
+ class ChannelReceiveSerializer extends QueueWorkerWorkSerializer
{
@Override
protected String getThreadName()
{
return "ReceiveSerializer-" + connector.getLocation() + channelIndex;
}
- };
+ }
+
+ receiveSerializer = new ChannelReceiveSerializer();
}
}
@@ -264,65 +263,6 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
/**
* @author Eike Stepper
*/
- @SuppressWarnings("unused")
- @Deprecated
- private final class ChannelIDImpl implements IChannelID, Cloneable, Serializable
- {
- private static final long serialVersionUID = 1L;
-
- public ChannelIDImpl()
- {
- }
-
- public IConnector getConnector()
- {
- return connector;
- }
-
- public short getChannelIndex()
- {
- return channelIndex;
- }
-
- @Override
- protected Object clone() throws CloneNotSupportedException
- {
- return this;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof IChannelID)
- {
- IChannelID that = (IChannelID)obj;
- return channelIndex == that.getChannelIndex() && ObjectUtil.equals(connector, that.getConnector());
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return ObjectUtil.hashCode(connector) ^ channelIndex;
- }
-
- @Override
- public String toString()
- {
- return "ChannelID[" + connector + ", channelIndex=" + channelIndex + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * @author Eike Stepper
- */
private final class ReceiverWork implements Runnable
{
private final IBuffer buffer;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannel.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannel.java
index f8c2966..2b25b5a 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannel.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannel.java
@@ -84,6 +84,12 @@ import org.eclipse.net4j.util.event.INotifier;
public interface IChannel extends IBufferHandler, INotifier
{
/**
+ * Returns the ID of this channel that is unique among all channels that the connector of this channel has ever
+ * created or will ever create.
+ */
+ public int getChannelID();
+
+ /**
* Returns the index of this channel within the array of channels returned from the
* {@link IConnector#getChannels() getChannels()} method of the connector of this channel.
*/
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannelID.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannelID.java
deleted file mode 100644
index 4986aba..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannelID.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j;
-
-/**
- * An identifier of an {@link IChannel} that is unique among all channels of all {@link IConnector}s.
- *
- * @author Eike Stepper
- */
-public interface IChannelID
-{
- /**
- * Returns the connector of the associated {@link IChannel}.
- */
- public IConnector getConnector();
-
- /**
- * Returns the channel index of the associated {@link IChannel} within its connector.
- */
- public short getChannelIndex();
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IConnector.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IConnector.java
index ca82864..da82498 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IConnector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IConnector.java
@@ -18,20 +18,18 @@ import org.eclipse.net4j.util.factory.IFactoryKey;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
import org.eclipse.net4j.util.registry.IRegistry;
-import org.eclipse.internal.net4j.Channel;
-import org.eclipse.internal.net4j.Connector;
-
import java.util.List;
/**
* One endpoint of a physical connection of arbitrary nature between two communicating parties. A {@link IConnector}
* encapsulates the process of establishing and closing such connections and has a {@link ConnectorLocation} of
- * {@link ConnectorLocation#CLIENT} or {@link ConnectorLocation#SERVER} with respect to this process. Once a connection
- * is established either party can use its connector to open multiple {@link IChannel}s to asynchronously exchange
- * {@link IBuffer}s.
+ * {@link ConnectorLocation#CLIENT CLIENT} or {@link ConnectorLocation#SERVER SERVER} with respect to this process. Once
+ * a connection is established either party can use its connector to open multiple {@link IChannel}s to asynchronously
+ * exchange {@link IBuffer}s.
* <p>
* This interface is <b>not</b> intended to be implemented by clients. Providers of connectors for new physical
- * connection types have to subclass {@link Connector} (see {@link Channel#setConnector(Connector)}.
+ * connection types have to subclass {@link org.eclipse.internal.net4j.Connector Connector} (see
+ * {@link org.eclipse.internal.net4j.Channel#setConnector(org.eclipse.internal.net4j.Connector) Channel#setConnector}).
* <p>
* <dt><b>Class Diagram:</b></dt>
* <dd><img src="doc-files/Connectors.png" title="Diagram Connectors" border="0" usemap="Connectors.png"/></dd>