summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-09-10 03:48:30 (EDT)
committerEike Stepper2007-09-10 03:48:30 (EDT)
commitbdf93c76a6b31f12f8101b926f9498b3bae6d984 (patch)
tree07a79afe1cdeb3e9284b6672a7f71562627cc142
parent4e3446008819292ad0668fcbe2ff44ce35c07356 (diff)
downloadcdo-bdf93c76a6b31f12f8101b926f9498b3bae6d984.zip
cdo-bdf93c76a6b31f12f8101b926f9498b3bae6d984.tar.gz
cdo-bdf93c76a6b31f12f8101b926f9498b3bae6d984.tar.bz2
[201267] failover strategy for CDO/NET4J
https://bugs.eclipse.org/bugs/show_bug.cgi?id=201267
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/FailOverStrategy.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/FailOverStrategy.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/FailOverStrategy.java
index cc1488a..be3d283 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/FailOverStrategy.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/FailOverStrategy.java
@@ -49,14 +49,28 @@ public class FailOverStrategy extends Notifier implements IFailOverStrategy
{
IChannel oldChannel = protocol.getChannel();
IConnector connector = getNewConnector(oldChannel);
+ if (connector == null)
+ {
+ throw new IllegalStateException("connector == null");
+ }
+
IChannel newChannel = connector.openChannel(protocol);
protocol.setChannel(newChannel);
oldChannel.close();
fireEvent(new FailOverEvent(oldChannel, newChannel));
}
+ /**
+ * 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();
}