Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-09-23 15:30:54 +0000
committerEike Stepper2010-09-23 15:30:54 +0000
commit6f7a14f4e6f2a5a0073469e24e83e7c5d66fa44f (patch)
tree17269247b87b286b61750957146ffe005ac382ec
parent3ad305914155e4884d4910235f209422c93d78f9 (diff)
downloadcdo-6f7a14f4e6f2a5a0073469e24e83e7c5d66fa44f.tar.gz
cdo-6f7a14f4e6f2a5a0073469e24e83e7c5d66fa44f.tar.xz
cdo-6f7a14f4e6f2a5a0073469e24e83e7c5d66fa44f.zip
[325928] Provide FailoverMonitor server and FailoverAgents to coordinate fail-over scenarios
https://bugs.eclipse.org/bugs/show_bug.cgi?id=325928
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionConfigurationImpl.java27
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java20
3 files changed, 22 insertions, 28 deletions
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java
index e51d7a8106..928303113a 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java
@@ -31,6 +31,7 @@ import org.eclipse.emf.cdo.server.net4j.FailoverAgent;
import org.eclipse.emf.cdo.server.net4j.FailoverMonitor;
import org.eclipse.emf.cdo.server.net4j.FailoverMonitor.AgentProtocol;
import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
+import org.eclipse.emf.cdo.spi.server.InternalFailoverParticipant;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.net4j.Net4jUtil;
@@ -424,7 +425,7 @@ public abstract class FailoverExample
protected IRepository createRepository(IStore store, Map<String, String> props)
{
ISynchronizableRepository repository = CDOServerUtil.createFailoverParticipant(name, store, props);
- // ((InternalFailoverParticipant)repository).setAllowBackupCommits(true); // Load balancing!
+ ((InternalFailoverParticipant)repository).setAllowBackupCommits(true); // Load balancing!
FailoverAgent agent = new FailoverAgent()
{
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionConfigurationImpl.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionConfigurationImpl.java
index d5d8fb2436..6a3e7af1e5 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionConfigurationImpl.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionConfigurationImpl.java
@@ -45,9 +45,9 @@ public class FailoverCDOSessionConfigurationImpl extends CDONet4jSessionConfigur
{
private String monitorConnectorDescription;
- private IConnector monitorConnector;
-
- private SignalProtocol<Object> monitorProtocol;
+ // private IConnector monitorConnector;
+ //
+ // private SignalProtocol<Object> monitorProtocol;
private String repositoryGroup;
@@ -146,12 +146,9 @@ public class FailoverCDOSessionConfigurationImpl extends CDONet4jSessionConfigur
protected void queryRepositoryInfoFromMonitor()
{
- if (monitorConnector == null)
- {
- monitorConnector = getConnector(monitorConnectorDescription);
- monitorProtocol = new SignalProtocol<Object>("failover-client");
- monitorProtocol.open(monitorConnector);
- }
+ IConnector connector = getConnector(monitorConnectorDescription);
+ SignalProtocol<Object> protocol = new SignalProtocol<Object>("failover-client");
+ protocol.open(connector);
try
{
@@ -161,7 +158,7 @@ public class FailoverCDOSessionConfigurationImpl extends CDONet4jSessionConfigur
while (ObjectUtil.equals(repositoryConnectorDescription, oldRepositoryConnectorDescription)
&& ObjectUtil.equals(repositoryName, oldRepositoryName))
{
- new RequestWithConfirmation<Boolean>(monitorProtocol, (short)1, "QueryRepositoryInfo")
+ new RequestWithConfirmation<Boolean>(protocol, (short)1, "QueryRepositoryInfo")
{
@Override
protected void requesting(ExtendedDataOutputStream out) throws Exception
@@ -185,11 +182,11 @@ public class FailoverCDOSessionConfigurationImpl extends CDONet4jSessionConfigur
}
finally
{
- // protocol.close();
- // if (connector.getChannels().isEmpty())
- // {
- // connector.close();
- // }
+ protocol.close();
+ if (connector.getChannels().isEmpty())
+ {
+ connector.close();
+ }
}
}
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 08d085ffe9..74e8f4c9a8 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
@@ -231,8 +231,10 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I
if (firstChannel)
{
- checkSelectionKey();
- selector.orderWriteInterest(selectionKey, isClient(), true);
+ if (selectionKey != null)
+ {
+ selector.orderWriteInterest(selectionKey, isClient(), true);
+ }
}
}
}
@@ -264,8 +266,10 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I
if (writeQueue.isEmpty())
{
- checkSelectionKey();
- selector.orderWriteInterest(selectionKey, isClient(), false);
+ if (selectionKey != null)
+ {
+ selector.orderWriteInterest(selectionKey, isClient(), false);
+ }
}
}
}
@@ -390,14 +394,6 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I
}
}
- private void checkSelectionKey()
- {
- if (selectionKey == null)
- {
- throw new IllegalStateException("No selection key for connector " + this); //$NON-NLS-1$
- }
- }
-
/**
* @author Eike Stepper
*/

Back to the top