Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-09-22 11:09:53 +0000
committerEike Stepper2010-09-22 11:09:53 +0000
commitb3444d952ce0a151400144c5cc70eb6aaf4b45db (patch)
treeceb5eee65d62a059a898c9b6ced6c93a73039059
parent20642512fac8bf388bc6927f0f262a4d71ad8f55 (diff)
downloadcdo-b3444d952ce0a151400144c5cc70eb6aaf4b45db.tar.gz
cdo-b3444d952ce0a151400144c5cc70eb6aaf4b45db.tar.xz
cdo-b3444d952ce0a151400144c5cc70eb6aaf4b45db.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.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionConfigurationImpl.java61
1 files changed, 59 insertions, 2 deletions
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 ea78b79c2c..9efd438c24 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
@@ -10,8 +10,12 @@
*/
package org.eclipse.emf.cdo.internal.net4j;
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.net4j.FailoverCDOSessionConfiguration;
import org.eclipse.emf.cdo.session.CDOSession.ExceptionHandler;
+import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.signal.RequestWithConfirmation;
@@ -24,7 +28,12 @@ import org.eclipse.net4j.util.container.IPluginContainer;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
+import org.eclipse.emf.spi.cdo.InternalCDOView;
+
+import java.util.ArrayList;
+import java.util.List;
/**
* @author Eike Stepper
@@ -107,6 +116,10 @@ public class FailoverCDOSessionConfigurationImpl extends CDONet4jSessionConfigur
{
try
{
+ List<Object> targets = getViewTargets(session);
+ setPassiveUpdateEnabled(session.options().isPassiveUpdateEnabled());
+ setPassiveUpdateMode(session.options().getPassiveUpdateMode());
+
Pair<String, String> info = queryRepositoryInfoFromMonitor();
IConnector connector = getConnector(info.getElement1());
String repositoryName = null;
@@ -115,8 +128,8 @@ public class FailoverCDOSessionConfigurationImpl extends CDONet4jSessionConfigur
superSetRepositoryName(repositoryName);
initProtocol(session);
- // TODO Re-register all remote sessions
- // TODO Re-register all views
+ reregisterViews(session, targets);
+ reregisterRemoteSessions(session);
}
catch (RuntimeException ex)
{
@@ -173,4 +186,48 @@ public class FailoverCDOSessionConfigurationImpl extends CDONet4jSessionConfigur
{
return IPluginContainer.INSTANCE;
}
+
+ private List<Object> getViewTargets(FailoverCDOSessionImpl session)
+ {
+ List<Object> targets = new ArrayList<Object>();
+ for (InternalCDOView view : session.getViews())
+ {
+ if (view instanceof CDOTransaction)
+ {
+ CDOTransaction transaction = (CDOTransaction)view;
+ targets.add(transaction.getBranch());
+ }
+ else
+ {
+ targets.add(CDOBranchUtil.copyBranchPoint(view));
+ }
+ }
+
+ return targets;
+ }
+
+ private void reregisterViews(FailoverCDOSessionImpl session, List<Object> targets)
+ {
+ CDOSessionProtocol sessionProtocol = session.getSessionProtocol();
+ int viewID = 0;
+
+ for (Object target : targets)
+ {
+ if (target instanceof CDOBranchPoint)
+ {
+ CDOBranchPoint branchPoint = (CDOBranchPoint)target;
+ sessionProtocol.openView(++viewID, branchPoint, true);
+ }
+ else
+ {
+ CDOBranch branch = (CDOBranch)target;
+ sessionProtocol.openView(++viewID, branch.getHead(), false);
+ }
+ }
+ }
+
+ private void reregisterRemoteSessions(FailoverCDOSessionImpl session)
+ {
+ // TODO
+ }
}

Back to the top