[jboss-cvs] JBoss Messaging SVN: r1754 - in branches/Branch_Client_Failover_Experiment/src/main/org/jboss: jms/server/endpoint messaging/core/plugin/postoffice/cluster
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Dec 10 17:06:27 EST 2006
Author: timfox
Date: 2006-12-10 17:06:23 -0500 (Sun, 10 Dec 2006)
New Revision: 1754
Added:
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ConnectionStatus.java
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/FailoverStatus.java
Log:
Missing files
Added: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ConnectionStatus.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ConnectionStatus.java 2006-12-10 12:37:08 UTC (rev 1753)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ConnectionStatus.java 2006-12-10 22:06:23 UTC (rev 1754)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.server.endpoint;
+
+import java.io.Serializable;
+
+import org.jboss.jms.delegate.ConnectionDelegate;
+
+/**
+ * A ConnectionStatus
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 1.1 $</tt>
+ *
+ * $Id$
+ *
+ */
+public class ConnectionStatus implements Serializable
+{
+ private static final long serialVersionUID = 4311863642735135167L;
+
+ private ConnectionDelegate delegate;
+
+ private int actualFailoverNodeId;
+
+ public ConnectionStatus(ConnectionDelegate del)
+ {
+ this.delegate = del;
+ }
+
+ public ConnectionStatus(int actualFailoverNode)
+ {
+ this.actualFailoverNodeId = actualFailoverNode;
+ }
+
+ public ConnectionDelegate getDelegate()
+ {
+ return delegate;
+ }
+
+ public int getActualFailoverNode()
+ {
+ return actualFailoverNodeId;
+ }
+
+}
Added: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/FailoverStatus.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/FailoverStatus.java 2006-12-10 12:37:08 UTC (rev 1753)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/FailoverStatus.java 2006-12-10 22:06:23 UTC (rev 1754)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.core.plugin.postoffice.cluster;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A FailoverStatus
+ *
+ * This class is a state machine for failover state for a node
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 1.1 $</tt>
+ *
+ * $Id$
+ *
+ */
+public class FailoverStatus implements Serializable
+{
+ private static final long serialVersionUID = -2668162690753929133L;
+
+ //The set of nodes the server has completed failover for since it was last restarted
+ private Set failedOverForNodes;
+
+ //The node the server is currently failing over for (if any)
+ private int currentlyFailingOverForNode;
+
+ //Is the server currently failing over?
+ private boolean failingOver;
+
+ public FailoverStatus()
+ {
+ failedOverForNodes = new LinkedHashSet();
+ }
+
+ public void startFailingOverForNode(int nodeId)
+ {
+ if (failingOver)
+ {
+ throw new IllegalStateException("Already failing over for node " + currentlyFailingOverForNode);
+ }
+
+ currentlyFailingOverForNode = nodeId;
+
+ failingOver = true;
+ }
+
+ public void finishFailingOver()
+ {
+ if (!failingOver)
+ {
+ throw new IllegalStateException("The node is not currently failing over");
+ }
+
+ failedOverForNodes.add(new Integer(currentlyFailingOverForNode));
+
+ failingOver = false;
+ }
+
+ public Set getFailedOverForNodes()
+ {
+ return Collections.unmodifiableSet(failedOverForNodes);
+ }
+
+ public boolean isFailedOverForNode(int nodeId)
+ {
+ return failedOverForNodes.contains(new Integer(nodeId));
+ }
+
+ public boolean isFailingOverForNode(int nodeId)
+ {
+ return failingOver && currentlyFailingOverForNode == nodeId;
+ }
+
+}
More information about the jboss-cvs-commits
mailing list