Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-09-22 10:54:59 +0000
committerEike Stepper2010-09-22 10:54:59 +0000
commit20642512fac8bf388bc6927f0f262a4d71ad8f55 (patch)
treea6f6dd816b3a8d92ad60a771272e69a787e1939f
parent45cfff9677ce44d86e4d00ae52219f800d7f15ab (diff)
downloadcdo-20642512fac8bf388bc6927f0f262a4d71ad8f55.tar.gz
cdo-20642512fac8bf388bc6927f0f262a4d71ad8f55.tar.xz
cdo-20642512fac8bf388bc6927f0f262a4d71ad8f55.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.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionImpl.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDOSessionFailoverEvent.java30
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionEvent.java1
4 files changed, 60 insertions, 4 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 440f9794e8..ea78b79c2c 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
@@ -103,7 +103,7 @@ public class FailoverCDOSessionConfigurationImpl extends CDONet4jSessionConfigur
return new FailoverCDOSessionImpl(this);
}
- public void sessionProtocolDeactivated(FailoverCDOSessionImpl session)
+ public void failover(FailoverCDOSessionImpl session)
{
try
{
@@ -118,9 +118,15 @@ public class FailoverCDOSessionConfigurationImpl extends CDONet4jSessionConfigur
// TODO Re-register all remote sessions
// TODO Re-register all views
}
- catch (Throwable t)
+ catch (RuntimeException ex)
{
session.deactivate();
+ throw ex;
+ }
+ catch (Error ex)
+ {
+ session.deactivate();
+ throw ex;
}
}
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionImpl.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionImpl.java
index 257da43108..094013173e 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionImpl.java
@@ -10,6 +10,9 @@
*/
package org.eclipse.emf.cdo.internal.net4j;
+import org.eclipse.emf.cdo.net4j.CDOSessionFailoverEvent;
+import org.eclipse.emf.cdo.session.CDOSession;
+
/**
* @author Eike Stepper
*/
@@ -29,6 +32,24 @@ public class FailoverCDOSessionImpl extends CDONet4jSessionImpl
@Override
protected void sessionProtocolDeactivated()
{
- getConfiguration().sessionProtocolDeactivated(this);
+ fireFailoverEvent(CDOSessionFailoverEvent.Type.STARTED);
+ getConfiguration().failover(this);
+ fireFailoverEvent(CDOSessionFailoverEvent.Type.FINISHED);
+ }
+
+ private void fireFailoverEvent(final CDOSessionFailoverEvent.Type type)
+ {
+ fireEvent(new CDOSessionFailoverEvent()
+ {
+ public CDOSession getSource()
+ {
+ return FailoverCDOSessionImpl.this;
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+ });
}
}
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDOSessionFailoverEvent.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDOSessionFailoverEvent.java
new file mode 100644
index 0000000000..8da6229d58
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDOSessionFailoverEvent.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.net4j;
+
+import org.eclipse.emf.cdo.session.CDOSessionEvent;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public interface CDOSessionFailoverEvent extends CDOSessionEvent
+{
+ public Type getType();
+
+ /**
+ * @author Eike Stepper
+ */
+ public enum Type
+ {
+ STARTED, FINISHED
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionEvent.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionEvent.java
index 46a4b2099c..85ba576ace 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionEvent.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionEvent.java
@@ -14,7 +14,6 @@ import org.eclipse.net4j.util.event.IEvent;
/**
* @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
public interface CDOSessionEvent extends IEvent

Back to the top