Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/net4j/FailoverMonitor.java21
2 files changed, 14 insertions, 14 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 d64cf6a839..e51d7a8106 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,7 +31,6 @@ 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;
@@ -425,7 +424,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()
{
@@ -448,8 +447,8 @@ public abstract class FailoverExample
agent.setConnectorDescription(host + ":" + port);
agent.setRepository(repository);
agent.setGroup(REPOSITORY_GROUP);
- agent.setRate(200L);
- agent.setTimeout(2000L);
+ agent.setRate(1000L);
+ agent.setTimeout(4000L);
agent.activate();
return repository;
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/net4j/FailoverMonitor.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/net4j/FailoverMonitor.java
index c651c6d344..2dc6186160 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/net4j/FailoverMonitor.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/net4j/FailoverMonitor.java
@@ -82,8 +82,8 @@ public class FailoverMonitor extends Container<AgentProtocol>
public void registerAgent(AgentProtocol agent)
{
- AgentProtocol[] newAgents = null;
AgentProtocol newMasterAgent = null;
+ AgentProtocol[] newAgents = null;
synchronized (agents)
{
@@ -91,14 +91,15 @@ public class FailoverMonitor extends Container<AgentProtocol>
if (agents.size() == 1)
{
masterAgent = agent;
- newAgents = getElements();
- newMasterAgent = masterAgent;
}
+
+ newMasterAgent = masterAgent;
+ newAgents = getElements();
}
if (newMasterAgent != null)
{
- publishNewMaster(newAgents, newMasterAgent);
+ publishNewMaster(newMasterAgent, newAgents);
}
fireElementAddedEvent(agent);
@@ -106,8 +107,8 @@ public class FailoverMonitor extends Container<AgentProtocol>
public void deregisterAgent(AgentProtocol agent)
{
- AgentProtocol[] newAgents = null;
AgentProtocol newMasterAgent = null;
+ AgentProtocol[] newAgents = null;
synchronized (agents)
{
@@ -126,15 +127,15 @@ public class FailoverMonitor extends Container<AgentProtocol>
{
masterAgent = electNewMaster(agents);
}
-
- newAgents = getElements();
- newMasterAgent = masterAgent;
}
+
+ newMasterAgent = masterAgent;
+ newAgents = getElements();
}
if (newMasterAgent != null)
{
- publishNewMaster(newAgents, newMasterAgent);
+ publishNewMaster(newMasterAgent, newAgents);
}
fireElementRemovedEvent(agent);
@@ -152,7 +153,7 @@ public class FailoverMonitor extends Container<AgentProtocol>
return agents.iterator().next();
}
- private void publishNewMaster(AgentProtocol[] agents, final AgentProtocol masterAgent)
+ private void publishNewMaster(final AgentProtocol masterAgent, AgentProtocol[] agents)
{
for (final AgentProtocol agent : agents)
{

Back to the top