Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-08-13 06:28:10 +0000
committerEike Stepper2015-08-13 06:28:10 +0000
commit9e42d1e8f68b55e5ec227fe4039f15fb4be3fc18 (patch)
treed3edeb87f0ba194fa877ed8ca76d97f381943725 /plugins/org.eclipse.emf.cdo.examples
parent9ff8b8b13cedbe47e24674afebb6e64f61673b99 (diff)
downloadcdo-9e42d1e8f68b55e5ec227fe4039f15fb4be3fc18.tar.gz
cdo-9e42d1e8f68b55e5ec227fe4039f15fb4be3fc18.tar.xz
cdo-9e42d1e8f68b55e5ec227fe4039f15fb4be3fc18.zip
[Releng] Fix org.eclipse.emf.cdo.examples.server.FailoverExample.Unmonitored
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.examples')
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java28
1 files changed, 17 insertions, 11 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 452d0ce34c..8f45e60d1d 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
@@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.common.util.RepositoryStateChangedEvent;
import org.eclipse.emf.cdo.common.util.RepositoryTypeChangedEvent;
import org.eclipse.emf.cdo.examples.company.CompanyFactory;
+import org.eclipse.emf.cdo.examples.company.CompanyPackage;
import org.eclipse.emf.cdo.examples.company.Customer;
import org.eclipse.emf.cdo.net4j.CDONet4jSession;
import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
@@ -191,7 +192,7 @@ public abstract class FailoverExample
{
System.out.println();
System.out.println(repository.getName() + ": " + repository.getType()
- + (repository.getType() == Type.BACKUP ? "|" + repository.getState() : ""));
+ + (repository.getType() == Type.BACKUP ? "|" + repository.getState() : ""));
}
else if ("0".equals(command))
{
@@ -253,9 +254,10 @@ public abstract class FailoverExample
return Net4jUtil.getConnector(container, TRANSPORT_TYPE, description);
}
- protected IRepositorySynchronizer createRepositorySynchronizer(IConnector connector, String repositoryName)
+ protected IRepositorySynchronizer createRepositorySynchronizer(String peerHost, int peerPort, String repositoryName)
{
- CDOSessionConfigurationFactory factory = createSessionConfigurationFactory(connector, repositoryName);
+ CDOSessionConfigurationFactory factory = createSessionConfigurationFactory(peerHost + ":" + peerPort,
+ repositoryName);
IRepositorySynchronizer synchronizer = CDOServerUtil.createRepositorySynchronizer(factory);
synchronizer.setRetryInterval(2);
@@ -264,20 +266,22 @@ public abstract class FailoverExample
return synchronizer;
}
- protected CDOSessionConfigurationFactory createSessionConfigurationFactory(final IConnector connector,
+ protected CDOSessionConfigurationFactory createSessionConfigurationFactory(final String connectorDescription,
final String repositoryName)
{
return new CDOSessionConfigurationFactory()
{
public CDONet4jSessionConfiguration createSessionConfiguration()
{
- return FailoverExample.this.createSessionConfiguration(connector, repositoryName);
+ return FailoverExample.this.createSessionConfiguration(connectorDescription, repositoryName);
}
};
}
- protected CDONet4jSessionConfiguration createSessionConfiguration(IConnector connector, String repositoryName)
+ protected CDONet4jSessionConfiguration createSessionConfiguration(String connectorDescription, String repositoryName)
{
+ IConnector connector = createConnector(connectorDescription);
+
CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
configuration.setConnector(connector);
configuration.setRepositoryName(repositoryName);
@@ -311,9 +315,11 @@ public abstract class FailoverExample
@Override
protected IRepository createRepository(IStore store, Map<String, String> props)
{
- IConnector connector = createConnector(peerHost + ":" + peerPort);
- IRepositorySynchronizer synchronizer = createRepositorySynchronizer(connector, peerRepository);
- return CDOServerUtil.createFailoverParticipant(name, store, props, synchronizer, master);
+ IRepositorySynchronizer synchronizer = createRepositorySynchronizer(peerHost, peerPort, peerRepository);
+ ISynchronizableRepository repository = CDOServerUtil.createFailoverParticipant(name, store, props, synchronizer,
+ master);
+ repository.setInitialPackages(CompanyPackage.eINSTANCE);
+ return repository;
}
@Override
@@ -426,6 +432,7 @@ public abstract class FailoverExample
protected IRepository createRepository(IStore store, Map<String, String> props)
{
ISynchronizableRepository repository = CDOServerUtil.createFailoverParticipant(name, store, props);
+ repository.setInitialPackages(CompanyPackage.eINSTANCE);
((InternalFailoverParticipant)repository).setAllowBackupCommits(true); // Load balancing!
FailoverAgent agent = new FailoverAgent()
@@ -434,8 +441,7 @@ public abstract class FailoverExample
protected org.eclipse.emf.cdo.session.CDOSessionConfiguration createSessionConfiguration(
String connectorDescription, String repositoryName)
{
- IConnector connector = createConnector(connectorDescription);
- return Monitored.this.createSessionConfiguration(connector, repositoryName);
+ return Monitored.this.createSessionConfiguration(connectorDescription, repositoryName);
}
@Override

Back to the top