summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-12-29 11:08:36 (EST)
committerEike Stepper2007-12-29 11:08:36 (EST)
commit5d26503eb85ee023add2c14ed0e1e6fa618bcbd6 (patch)
treed27c15db289853454b3c3f0b9efa9674a8e265cc
parente35086970836ae2ceb12158e5d0e3aab5b9a20cc (diff)
downloadcdo-5d26503eb85ee023add2c14ed0e1e6fa618bcbd6.zip
cdo-5d26503eb85ee023add2c14ed0e1e6fa618bcbd6.tar.gz
cdo-5d26503eb85ee023add2c14ed0e1e6fa618bcbd6.tar.bz2
[213782] Transaction DeadLock
https://bugs.eclipse.org/bugs/show_bug.cgi?id=213782
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerIndication.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java16
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionPackageManager.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientRequest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/InvalidationIndication.java2
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java3
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java22
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java5
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java12
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPUnitTest.java28
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java26
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/CheckUtil.java61
-rw-r--r--plugins/org.eclipse.net4j/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Channel.java55
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java15
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannel.java5
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannelMultiplexer.java21
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Signal.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/FailOverStrategy.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/FailOverStrategy.java)39
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/IFailOverEvent.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IFailOverEvent.java)16
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/IFailOverStrategy.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IFailOverStrategy.java)3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/NOOPFailOverStrategy.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/NOOPFailOverStrategy.java)3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/RetryFailOverStrategy.java38
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/wrapping/GZIPStreamWrapperInjector.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/GZIPStreamWrapperInjector.java)2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/wrapping/StreamWrapperInjector.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/StreamWrapperInjector.java)3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/wrapping/XORStreamWrapperInjector.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/XORStreamWrapperInjector.java)2
34 files changed, 291 insertions, 115 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerIndication.java
index c0c8d51..c871561 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerIndication.java
@@ -65,7 +65,7 @@ public abstract class CDOServerIndication extends IndicationWithResponse
}
@Override
- protected CDOServerProtocol getProtocol()
+ public CDOServerProtocol getProtocol()
{
return (CDOServerProtocol)super.getProtocol();
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java
index 0d414a1..f356829 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java
@@ -88,7 +88,7 @@ public class CDOEditorInput extends PlatformObject implements IEditorInput
public String getToolTipText()
{
CDOSession session = view.getSession();
- IConnector connector = session.getChannel().getConnector();
+ IConnector connector = session.getConnector();
String repositoryName = session.getRepositoryName();
StringBuilder builder = new StringBuilder();
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
index 60063ef..4329d39 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
@@ -238,7 +238,7 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
public static String getSessionLabel(CDOSession session)
{
- IConnector connector = session.getChannel().getConnector();
+ IConnector connector = session.getConnector();
String repositoryName = session.getRepositoryName();
return "Session " + connector.getURL() + "/" + repositoryName + " [" + session.getSessionID() + "]";
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java
index d29c0a2..cd05769 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java
@@ -14,7 +14,8 @@ import org.eclipse.emf.cdo.protocol.model.CDOPackageManager;
import org.eclipse.emf.cdo.util.CDOPackageRegistry;
import org.eclipse.net4j.IChannel;
-import org.eclipse.net4j.signal.IFailOverStrategy;
+import org.eclipse.net4j.IConnector;
+import org.eclipse.net4j.signal.failover.IFailOverStrategy;
import org.eclipse.net4j.util.container.IContainer;
import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -38,6 +39,8 @@ public interface CDOSession extends IContainer<CDOView>
public IChannel getChannel();
+ public IConnector getConnector();
+
public boolean isOpen();
public String getRepositoryName();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
index 973d116..22be39a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
@@ -29,7 +29,7 @@ import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.net4j.ConnectorException;
import org.eclipse.net4j.IConnector;
-import org.eclipse.net4j.signal.IFailOverStrategy;
+import org.eclipse.net4j.signal.failover.IFailOverStrategy;
import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
index 3c58213..4108da2 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
@@ -29,7 +29,7 @@ import org.eclipse.emf.internal.cdo.protocol.LoadRevisionRequest;
import org.eclipse.net4j.IChannel;
import org.eclipse.net4j.internal.util.om.trace.PerfTracer;
-import org.eclipse.net4j.signal.IFailOverStrategy;
+import org.eclipse.net4j.signal.failover.IFailOverStrategy;
import java.util.ArrayList;
import java.util.Collection;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
index c38201a..e671b0b 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
@@ -39,8 +39,8 @@ import org.eclipse.net4j.internal.util.container.Container;
import org.eclipse.net4j.internal.util.event.Event;
import org.eclipse.net4j.internal.util.lifecycle.LifecycleEventAdapter;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
-import org.eclipse.net4j.signal.IFailOverEvent;
-import org.eclipse.net4j.signal.IFailOverStrategy;
+import org.eclipse.net4j.signal.failover.IFailOverEvent;
+import org.eclipse.net4j.signal.failover.IFailOverStrategy;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.event.EventUtil;
@@ -92,7 +92,7 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
if (event instanceof IFailOverEvent)
{
IFailOverEvent e = (IFailOverEvent)event;
- handleFailOver(e.getOldChannel(), e.getNewChannel());
+ handleFailOver(e.getOldChannel(), e.getNewChannel(), e.getNewConnector());
}
}
};
@@ -203,11 +203,6 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
return channel;
}
- public void setChannel(IChannel channel)
- {
- this.channel = channel;
- }
-
public String getRepositoryName()
{
return repositoryName;
@@ -523,7 +518,6 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
@Override
public String toString()
{
- IConnector connector = channel == null ? null : channel.getConnector();
return MessageFormat.format("CDOSession[{0}/{1}]", connector, repositoryName);
}
@@ -580,13 +574,13 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
fireElementAddedEvent(view);
}
- protected void handleFailOver(IChannel oldChannel, IChannel newChannel)
+ protected void handleFailOver(IChannel oldChannel, IChannel newChannel, IConnector newConnector)
{
EventUtil.removeListener(oldChannel, channelListener);
EventUtil.addListener(newChannel, channelListener);
channel = newChannel;
- connector = channel.getConnector();
+ connector = newConnector;
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionPackageManager.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionPackageManager.java
index 16ff25b..aff814e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionPackageManager.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionPackageManager.java
@@ -21,7 +21,7 @@ import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.protocol.LoadPackageRequest;
import org.eclipse.emf.internal.cdo.util.ModelUtil;
-import org.eclipse.net4j.signal.IFailOverStrategy;
+import org.eclipse.net4j.signal.failover.IFailOverStrategy;
import org.eclipse.emf.ecore.EPackage;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
index 1b8d263..15a967a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
@@ -32,7 +32,7 @@ import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.net4j.IChannel;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
-import org.eclipse.net4j.signal.IFailOverStrategy;
+import org.eclipse.net4j.signal.failover.IFailOverStrategy;
import org.eclipse.net4j.util.fsm.FiniteStateMachine;
import org.eclipse.net4j.util.fsm.ITransition;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
index c2b8ed1..ead8635 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
@@ -36,7 +36,7 @@ import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.net4j.IChannel;
import org.eclipse.net4j.internal.util.event.Notifier;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
-import org.eclipse.net4j.signal.IFailOverStrategy;
+import org.eclipse.net4j.signal.failover.IFailOverStrategy;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.transaction.TransactionException;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
index 1631b7e..09e15ee 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
@@ -41,7 +41,7 @@ import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
-import org.eclipse.net4j.signal.IFailOverStrategy;
+import org.eclipse.net4j.signal.failover.IFailOverStrategy;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.ref.ReferenceValueMap;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientRequest.java
index 1503c64..e045c4a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientRequest.java
@@ -38,7 +38,7 @@ public abstract class CDOClientRequest<RESULT> extends RequestWithConfirmation<R
}
@Override
- protected CDOClientProtocol getProtocol()
+ public CDOClientProtocol getProtocol()
{
return (CDOClientProtocol)super.getProtocol();
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/InvalidationIndication.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/InvalidationIndication.java
index 1c355a7..cd7cb844 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/InvalidationIndication.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/InvalidationIndication.java
@@ -73,7 +73,7 @@ public class InvalidationIndication extends Indication
}
@Override
- protected CDOClientProtocol getProtocol()
+ public CDOClientProtocol getProtocol()
{
return (CDOClientProtocol)super.getProtocol();
}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java
index 477f716..5164792 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java
@@ -61,8 +61,7 @@ public abstract class JVMConnector extends Connector
return "jvm://" + name;
}
- @Override
- public void multiplexBuffer(IChannel localChannel)
+ public void multiplexChannel(IChannel localChannel)
{
short channelIndex = localChannel.getChannelIndex();
Channel peerChannel = peer.getChannel(channelIndex);
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
index c10c0b3..b7703e7 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
@@ -51,11 +51,13 @@ public final class ControlChannel extends Channel
private SynchronizingCorrelator<Short, Boolean> registrations = new SynchronizingCorrelator<Short, Boolean>();
+ private TCPConnector connector;
+
public ControlChannel(int channelID, TCPConnector connector)
{
- super(channelID, connector.getReceiveExecutor());
+ super(channelID, connector.getBufferProvider(), connector, connector.getReceiveExecutor());
+ this.connector = connector;
setChannelIndex(CONTROL_CHANNEL_INDEX);
- setConnector(connector);
}
@Override
@@ -64,10 +66,9 @@ public final class ControlChannel extends Channel
return true;
}
- @Override
public TCPConnector getConnector()
{
- return (TCPConnector)super.getConnector();
+ return connector;
}
public boolean registerChannel(int channelID, short channelIndex, IProtocol protocol)
@@ -126,11 +127,11 @@ public final class ControlChannel extends Channel
case OPCODE_NEGOTIATION:
{
assertNegotiating();
- INegotiationContext negotiationContext = getConnector().getNegotiationContext();
+ INegotiationContext negotiationContext = connector.getNegotiationContext();
while (negotiationContext == null)
{
ConcurrencyUtil.sleep(20);
- negotiationContext = getConnector().getNegotiationContext();
+ negotiationContext = connector.getNegotiationContext();
}
Receiver receiver = negotiationContext.getReceiver();
@@ -150,7 +151,7 @@ public final class ControlChannel extends Channel
{
byte[] handlerFactoryUTF8 = BufferUtil.getByteArray(byteBuffer);
String protocolID = BufferUtil.fromUTF8(handlerFactoryUTF8);
- Channel channel = getConnector().createChannel(channelID, channelIndex, protocolID);
+ Channel channel = connector.createChannel(channelID, channelIndex, protocolID);
if (channel != null)
{
channel.activate();
@@ -188,7 +189,7 @@ public final class ControlChannel extends Channel
{
try
{
- getConnector().inverseRemoveChannel(channelID, channelIndex);
+ connector.inverseRemoveChannel(channelID, channelIndex);
}
catch (Exception ex)
{
@@ -201,7 +202,7 @@ public final class ControlChannel extends Channel
default:
OM.LOG.error("Invalid opcode: " + opcode); //$NON-NLS-1$
- getConnector().deactivate();
+ connector.deactivate();
}
}
finally
@@ -228,7 +229,6 @@ public final class ControlChannel extends Channel
private void assertNegotiating()
{
- TCPConnector connector = getConnector();
if (!connector.isNegotiating())
{
connector.deactivate();
@@ -238,7 +238,7 @@ public final class ControlChannel extends Channel
private void assertConnected()
{
- if (!getConnector().isConnected())
+ if (!connector.isConnected())
{
throw new IllegalStateException("Connector is not connected");
}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
index 5c792d2..f9d2547 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
@@ -112,8 +112,7 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I
* Called by {@link Channel} each time a new buffer is available for multiplexing. This or another buffer can be
* dequeued from the outputQueue of the {@link Channel}.
*/
- @Override
- public void multiplexBuffer(IChannel channel)
+ public void multiplexChannel(IChannel channel)
{
checkSelectionKey();
selector.orderWriteInterest(selectionKey, isClient(), true);
@@ -299,7 +298,7 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I
}
@Override
- protected boolean removeChannel(Channel channel)
+ public boolean removeChannel(IChannel channel)
{
if (channel instanceof ControlChannel)
{
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java
index 5d8d386..e88aa66 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java
@@ -11,10 +11,10 @@
package org.eclipse.net4j.tests;
import org.eclipse.net4j.IChannel;
-import org.eclipse.net4j.signal.FailOverStrategy;
-import org.eclipse.net4j.signal.IFailOverStrategy;
-import org.eclipse.net4j.tests.signal.IntRequest;
+import org.eclipse.net4j.signal.failover.IFailOverStrategy;
+import org.eclipse.net4j.signal.failover.RetryFailOverStrategy;
import org.eclipse.net4j.tests.signal.IntFailRequest;
+import org.eclipse.net4j.tests.signal.IntRequest;
import org.eclipse.net4j.tests.signal.TestSignalClientProtocolFactory;
import org.eclipse.net4j.tests.signal.TestSignalServerProtocolFactory;
import org.eclipse.net4j.util.container.IManagedContainer;
@@ -42,7 +42,7 @@ public class FailOverTest extends AbstractTransportTest
getAcceptor().deactivate();
int data = 0x0a;
- IFailOverStrategy failOverStrategy = new FailOverStrategy();
+ IFailOverStrategy failOverStrategy = new RetryFailOverStrategy(getConnector());
// Exception HERE
IntRequest request = new IntRequest(channel, data);
@@ -57,7 +57,7 @@ public class FailOverTest extends AbstractTransportTest
IChannel channel = getConnector().openChannel(TestSignalClientProtocolFactory.TYPE, null);
int data = 0x0a;
- IFailOverStrategy failOverStrategy = new FailOverStrategy();
+ IFailOverStrategy failOverStrategy = new RetryFailOverStrategy(getConnector());
// Exception HERE
IntRequest request = new IntRequest(channel, data);
@@ -75,7 +75,7 @@ public class FailOverTest extends AbstractTransportTest
IChannel channel = getConnector().openChannel(TestSignalClientProtocolFactory.TYPE, null);
int data = 0x0a;
- IFailOverStrategy failOverStrategy = new FailOverStrategy();
+ IFailOverStrategy failOverStrategy = new RetryFailOverStrategy(getConnector());
// Exception HERE
IntFailRequest request = new IntFailRequest(channel, data);
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPUnitTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPUnitTest.java
new file mode 100644
index 0000000..6d4280a
--- /dev/null
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPUnitTest.java
@@ -0,0 +1,28 @@
+/***************************************************************************
+ * 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.tests;
+
+import org.eclipse.net4j.util.tests.AbstractOMTest;
+
+/**
+ * @author Eike Stepper
+ */
+public class TCPUnitTest extends AbstractOMTest
+{
+ public TCPUnitTest()
+ {
+ }
+
+ public void test()
+ {
+
+ }
+}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java
index 0977273..44f1bf1 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/lifecycle/Lifecycle.java
@@ -13,6 +13,7 @@ package org.eclipse.net4j.internal.util.lifecycle;
import org.eclipse.net4j.internal.util.bundle.OM;
import org.eclipse.net4j.internal.util.event.Notifier;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
+import org.eclipse.net4j.util.CheckUtil;
import org.eclipse.net4j.util.ReflectUtil;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
@@ -151,6 +152,31 @@ public class Lifecycle extends Notifier implements ILifecycle.Introspection
}
}
+ protected final void checkNull(Object handle, String msg) throws NullPointerException
+ {
+ CheckUtil.checkNull(handle, msg);
+ }
+
+ protected final void checkArg(boolean expr, String msg) throws IllegalArgumentException
+ {
+ CheckUtil.checkArg(expr, msg);
+ }
+
+ protected final void checkArg(Object handle, String handleName) throws IllegalArgumentException
+ {
+ CheckUtil.checkArg(handle, handleName);
+ }
+
+ protected final void checkState(boolean expr, String msg) throws IllegalStateException
+ {
+ CheckUtil.checkState(expr, msg);
+ }
+
+ protected final void checkState(Object handle, String handleName) throws IllegalStateException
+ {
+ CheckUtil.checkState(handle, handleName);
+ }
+
protected final void deferredActivate()
{
lifecycleState = ILifecycleState.ACTIVE;
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/CheckUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/CheckUtil.java
new file mode 100644
index 0000000..c37a2d9
--- /dev/null
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/CheckUtil.java
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * 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.util;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CheckUtil
+{
+ private CheckUtil()
+ {
+ }
+
+ public static void checkNull(Object handle, String msg) throws NullPointerException
+ {
+ if (handle == null)
+ {
+ throw new NullPointerException(msg);
+ }
+ }
+
+ public static void checkArg(boolean expr, String msg) throws IllegalArgumentException
+ {
+ if (!expr)
+ {
+ throw new IllegalArgumentException(msg);
+ }
+ }
+
+ public static void checkArg(Object handle, String handleName) throws IllegalArgumentException
+ {
+ if (handle == null)
+ {
+ throw new IllegalArgumentException(handleName + " is null");
+ }
+ }
+
+ public static void checkState(boolean expr, String msg) throws IllegalStateException
+ {
+ if (!expr)
+ {
+ throw new IllegalStateException(msg);
+ }
+ }
+
+ public static void checkState(Object handle, String handleName) throws IllegalStateException
+ {
+ if (handle == null)
+ {
+ throw new IllegalStateException(handleName + " is null");
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
index f451626..1b75056 100644
--- a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
@@ -13,5 +13,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)";resoluti
Export-Package: org.eclipse.internal.net4j;version="0.8.0",
org.eclipse.net4j;version="0.8.0",
org.eclipse.net4j.signal;version="0.8.0",
+ org.eclipse.net4j.signal.failover;version="0.8.0",
+ org.eclipse.net4j.signal.wrapping;version="0.8.0",
org.eclipse.net4j.stream;version="0.8.0"
Eclipse-LazyStart: true
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 66ec23b..698b62e 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,6 +15,7 @@ import org.eclipse.net4j.IBuffer;
import org.eclipse.net4j.IBufferHandler;
import org.eclipse.net4j.IBufferProvider;
import org.eclipse.net4j.IChannel;
+import org.eclipse.net4j.IChannelMultiplexer;
import org.eclipse.net4j.internal.util.concurrent.QueueWorkerWorkSerializer;
import org.eclipse.net4j.internal.util.concurrent.SynchronousWorkSerializer;
import org.eclipse.net4j.internal.util.lifecycle.Lifecycle;
@@ -40,11 +41,14 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
private short channelIndex = Buffer.NO_CHANNEL;
- private Connector connector;
+ // private Connector connector;
+
+ private IBufferProvider bufferProvider;
+
+ private IChannelMultiplexer channelMultiplexer;
/**
* The external handler for buffers passed from the {@link #connector}.
- * <p>
*/
private IBufferHandler receiveHandler;
@@ -54,9 +58,12 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
private Queue<IBuffer> sendQueue;
- public Channel(int channelID, ExecutorService receiveExecutor)
+ public Channel(int channelID, IBufferProvider bufferProvider, IChannelMultiplexer channelMultiplexer,
+ ExecutorService receiveExecutor)
{
this.channelID = channelID;
+ this.bufferProvider = bufferProvider;
+ this.channelMultiplexer = channelMultiplexer;
this.receiveExecutor = receiveExecutor;
}
@@ -80,29 +87,29 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
this.channelIndex = channelIndex;
}
- public Connector getConnector()
- {
- return connector;
- }
-
- public void setConnector(Connector connector)
- {
- this.connector = connector;
- }
+ // public Connector getConnector()
+ // {
+ // return connector;
+ // }
+ //
+ // public void setConnector(Connector connector)
+ // {
+ // this.connector = connector;
+ // }
public short getBufferCapacity()
{
- return connector.getBufferProvider().getBufferCapacity();
+ return bufferProvider.getBufferCapacity();
}
public IBuffer provideBuffer()
{
- return connector.getBufferProvider().provideBuffer();
+ return bufferProvider.provideBuffer();
}
public void retainBuffer(IBuffer buffer)
{
- connector.getBufferProvider().retainBuffer(buffer);
+ bufferProvider.retainBuffer(buffer);
}
public Queue<IBuffer> getSendQueue()
@@ -166,7 +173,7 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
else
{
sendQueue.add(buffer);
- connector.multiplexBuffer(this);
+ channelMultiplexer.multiplexChannel(this);
}
}
@@ -198,15 +205,9 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
protected void doBeforeActivate() throws Exception
{
super.doBeforeActivate();
- if (channelIndex == Buffer.NO_CHANNEL)
- {
- throw new IllegalStateException("channelIndex == INVALID_CHANNEL_ID"); //$NON-NLS-1$
- }
-
- if (connector == null)
- {
- throw new IllegalStateException("connector == null"); //$NON-NLS-1$
- }
+ checkState(channelIndex != Buffer.NO_CHANNEL, "channelIndex == NO_CHANNEL"); //$NON-NLS-1$
+ checkState(bufferProvider, "bufferProvider"); //$NON-NLS-1$
+ checkState(channelMultiplexer, "channelMultiplexer"); //$NON-NLS-1$
}
@Override
@@ -230,7 +231,7 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
@Override
protected String getThreadName()
{
- return "ReceiveSerializer-" + connector.getLocation() + channelIndex;
+ return "ReceiveSerializer" + channelIndex;
}
}
@@ -244,7 +245,7 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
LifecycleUtil.deactivate(receiveHandler);
receiveHandler = null;
- connector.removeChannel(this);
+ channelMultiplexer.removeChannel(this);
if (receiveSerializer != null)
{
receiveSerializer.dispose();
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java
index ae2c161..d4c1f0d 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java
@@ -16,6 +16,7 @@ import org.eclipse.net4j.ConnectorState;
import org.eclipse.net4j.IBuffer;
import org.eclipse.net4j.IBufferProvider;
import org.eclipse.net4j.IChannel;
+import org.eclipse.net4j.IChannelMultiplexer;
import org.eclipse.net4j.IConnector;
import org.eclipse.net4j.IConnectorStateEvent;
import org.eclipse.net4j.IProtocol;
@@ -56,7 +57,7 @@ import java.util.concurrent.TimeoutException;
/**
* @author Eike Stepper
*/
-public abstract class Connector extends Container<IChannel> implements IConnector
+public abstract class Connector extends Container<IChannel> implements IConnector, IChannelMultiplexer
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_CONNECTOR, Connector.class);
@@ -107,8 +108,6 @@ public abstract class Connector extends Container<IChannel> implements IConnecto
{
}
- public abstract void multiplexBuffer(IChannel channel);
-
public ExecutorService getReceiveExecutor()
{
return receiveExecutor;
@@ -423,15 +422,15 @@ public abstract class Connector extends Container<IChannel> implements IConnecto
public Channel createChannel(int channelID, short channelIndex, IProtocol protocol)
{
- Channel channel = new Channel(channelID, receiveExecutor);
+ Channel channel = new Channel(channelID, bufferProvider, this, receiveExecutor);
if (protocol != null)
{
protocol.setChannel(channel);
LifecycleUtil.activate(protocol);
if (TRACER.isEnabled())
{
- TRACER.format(
- "Opening channel {0} with protocol {1}", channelIndex, protocol == null ? null : protocol.getType()); //$NON-NLS-1$
+ String protocolType = protocol == null ? null : protocol.getType();
+ TRACER.format("Opening channel {0} with protocol {1}", channelIndex, protocolType); //$NON-NLS-1$
}
}
else
@@ -443,7 +442,7 @@ public abstract class Connector extends Container<IChannel> implements IConnecto
}
channel.setChannelIndex(channelIndex);
- channel.setConnector(this);
+ // channel.setConnector(this);
channel.setReceiveHandler(protocol);
channel.addListener(channelListener); // TODO remove?
addChannel(channel);
@@ -527,7 +526,7 @@ public abstract class Connector extends Container<IChannel> implements IConnecto
/**
* @return <code>true</code> if the channel was removed, <code>false</code> otherwise.
*/
- protected boolean removeChannel(final Channel channel)
+ public boolean removeChannel(final IChannel channel)
{
if (channel == null)
{
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 2b25b5a..0bb2737 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannel.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannel.java
@@ -96,11 +96,6 @@ public interface IChannel extends IBufferHandler, INotifier
public short getChannelIndex();
/**
- * Returns the connector of this channel.
- */
- public IConnector getConnector();
-
- /**
* Asynchronously sends the given buffer to the receive handler of the peer channel.
*/
public void sendBuffer(IBuffer buffer);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannelMultiplexer.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannelMultiplexer.java
new file mode 100644
index 0000000..d224d97
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IChannelMultiplexer.java
@@ -0,0 +1,21 @@
+/***************************************************************************
+ * 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;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IChannelMultiplexer
+{
+ public void multiplexChannel(IChannel channel);
+
+ public boolean removeChannel(IChannel channel);
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Signal.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Signal.java
index 9344efa..bb3d6c1 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Signal.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Signal.java
@@ -42,7 +42,7 @@ public abstract class Signal implements Runnable
{
}
- protected SignalProtocol getProtocol()
+ public SignalProtocol getProtocol()
{
return protocol;
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/FailOverStrategy.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/FailOverStrategy.java
index ccf0343..773268e 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/FailOverStrategy.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/FailOverStrategy.java
@@ -8,18 +8,22 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.signal;
+package org.eclipse.net4j.signal.failover;
import org.eclipse.net4j.IChannel;
import org.eclipse.net4j.IConnector;
import org.eclipse.net4j.internal.util.event.Notifier;
+import org.eclipse.net4j.signal.RequestWithConfirmation;
+import org.eclipse.net4j.signal.SignalActor;
+import org.eclipse.net4j.signal.SignalProtocol;
+import org.eclipse.net4j.util.CheckUtil;
import java.util.concurrent.TimeoutException;
/**
* @author Eike Stepper
*/
-public class FailOverStrategy extends Notifier implements IFailOverStrategy
+public abstract class FailOverStrategy extends Notifier implements IFailOverStrategy
{
public FailOverStrategy()
{
@@ -48,31 +52,20 @@ public class FailOverStrategy extends Notifier implements IFailOverStrategy
protected void failOver(SignalProtocol protocol)
{
IChannel oldChannel = protocol.getChannel();
- IConnector connector = getNewConnector(oldChannel);
- if (connector == null)
- {
- throw new IllegalStateException("connector == null");
- }
+ IConnector newConnector = getNewConnector(oldChannel);
+ CheckUtil.checkNull(newConnector, "newConnector");
- IChannel newChannel = connector.openChannel(protocol);
+ IChannel newChannel = newConnector.openChannel(protocol);
protocol.setChannel(newChannel);
oldChannel.close();
- fireEvent(new FailOverEvent(oldChannel, newChannel));
+ fireEvent(new FailOverEvent(oldChannel, newChannel, newConnector));
}
/**
* Should be overridden to provide a fail-over <code>IConnector</code>. The oldChannel <i>can</i> be used as a
* hint.
*/
- protected IConnector getNewConnector(IChannel oldChannel)
- {
- if (oldChannel == null)
- {
- throw new IllegalArgumentException("oldChannel == null");
- }
-
- return oldChannel.getConnector();
- }
+ protected abstract IConnector getNewConnector(IChannel oldChannel);
/**
* @author Eike Stepper
@@ -83,10 +76,13 @@ public class FailOverStrategy extends Notifier implements IFailOverStrategy
private IChannel newChannel;
- public FailOverEvent(IChannel oldChannel, IChannel newChannel)
+ private IConnector newConnector;
+
+ public FailOverEvent(IChannel oldChannel, IChannel newChannel, IConnector newConnector)
{
this.oldChannel = oldChannel;
this.newChannel = newChannel;
+ this.newConnector = newConnector;
}
public IFailOverStrategy getSource()
@@ -103,5 +99,10 @@ public class FailOverStrategy extends Notifier implements IFailOverStrategy
{
return newChannel;
}
+
+ public IConnector getNewConnector()
+ {
+ return newConnector;
+ }
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IFailOverEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/IFailOverEvent.java
index b16ed1f..cd0d5bf 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IFailOverEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/IFailOverEvent.java
@@ -8,9 +8,10 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.signal;
+package org.eclipse.net4j.signal.failover;
import org.eclipse.net4j.IChannel;
+import org.eclipse.net4j.IConnector;
import org.eclipse.net4j.util.event.IEvent;
/**
@@ -19,14 +20,19 @@ import org.eclipse.net4j.util.event.IEvent;
public interface IFailOverEvent extends IEvent
{
/**
- * @return The old channel that was active before the fail over occured. At the time this event is being sent the old
- * channel is already closed.
+ * Returns the old channel that was active before the fail over occured. At the time this event is being sent the old
+ * channel is already closed.
*/
public IChannel getOldChannel();
/**
- * @return The new channel that is active after the fail over occured. At the time this event is being sent the new
- * channel is already active.
+ * Returns the new channel that is active after the fail over occured. At the time this event is being sent the new
+ * channel is already active.
*/
public IChannel getNewChannel();
+
+ /**
+ * Returns the connector of the new channel.
+ */
+ public IConnector getNewConnector();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IFailOverStrategy.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/IFailOverStrategy.java
index 859aab2..0bdcc64 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IFailOverStrategy.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/IFailOverStrategy.java
@@ -8,8 +8,9 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.signal;
+package org.eclipse.net4j.signal.failover;
+import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.event.INotifier;
/**
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/NOOPFailOverStrategy.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/NOOPFailOverStrategy.java
index 3e08d07..2230a08 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/NOOPFailOverStrategy.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/NOOPFailOverStrategy.java
@@ -8,8 +8,9 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.signal;
+package org.eclipse.net4j.signal.failover;
+import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.event.IListener;
/**
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/RetryFailOverStrategy.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/RetryFailOverStrategy.java
new file mode 100644
index 0000000..b9d7e41
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/failover/RetryFailOverStrategy.java
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * 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.signal.failover;
+
+import org.eclipse.net4j.IChannel;
+import org.eclipse.net4j.IConnector;
+
+/**
+ * @author Eike Stepper
+ */
+public class RetryFailOverStrategy extends FailOverStrategy
+{
+ private IConnector connector;
+
+ public RetryFailOverStrategy(IConnector connector)
+ {
+ this.connector = connector;
+ }
+
+ public IConnector getConnector()
+ {
+ return connector;
+ }
+
+ @Override
+ protected IConnector getNewConnector(IChannel oldChannel)
+ {
+ return connector;
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/GZIPStreamWrapperInjector.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/wrapping/GZIPStreamWrapperInjector.java
index 8b0dccc..7a0669b 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/GZIPStreamWrapperInjector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/wrapping/GZIPStreamWrapperInjector.java
@@ -8,7 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.signal;
+package org.eclipse.net4j.signal.wrapping;
import org.eclipse.net4j.util.io.GZIPStreamWrapper;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/StreamWrapperInjector.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/wrapping/StreamWrapperInjector.java
index 7410d13..a696492 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/StreamWrapperInjector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/wrapping/StreamWrapperInjector.java
@@ -8,8 +8,9 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.signal;
+package org.eclipse.net4j.signal.wrapping;
+import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.container.IElementProcessor;
import org.eclipse.net4j.util.container.IManagedContainer;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/XORStreamWrapperInjector.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/wrapping/XORStreamWrapperInjector.java
index a4a51f7..b28dc59 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/XORStreamWrapperInjector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/wrapping/XORStreamWrapperInjector.java
@@ -8,7 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.signal;
+package org.eclipse.net4j.signal.wrapping;
import org.eclipse.net4j.util.io.XORStreamWrapper;