[jboss-cvs] JBossAS SVN: r105445 - projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon May 31 23:04:18 EDT 2010


Author: bstansberry at jboss.com
Date: 2010-05-31 23:04:17 -0400 (Mon, 31 May 2010)
New Revision: 105445

Added:
   projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/SerializableStateTransferResult.java
   projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StateTransferResult.java
   projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StateTransferStreamProvider.java
   projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StreamStateTransferResult.java
Modified:
   projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupStateTransferService.java
Log:
[JBCLUSTER-276] Add more sophisticated state transfer handling

Modified: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupStateTransferService.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupStateTransferService.java	2010-06-01 02:59:25 UTC (rev 105444)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupStateTransferService.java	2010-06-01 03:04:17 UTC (rev 105445)
@@ -22,7 +22,6 @@
 
 package org.jboss.ha.framework.interfaces;
 
-import java.io.Serializable;
 import java.util.concurrent.Future;
 
 /**
@@ -52,7 +51,7 @@
     * @return <code>Future</code> whose {@link Future#get() get()} method will
     *         return the service state when it becomes available.
     */
-   Future<Serializable> getServiceState(String serviceName);
+   Future<SerializableStateTransferResult> getServiceState(String serviceName);
    
    /**
     * Gets the current service state from an existing member of the group, using
@@ -68,9 +67,24 @@
     * @return <code>Future</code> whose {@link Future#get() get()} method will
     *         return the service state when it becomes available.
     */
-   Future<Serializable> getServiceState(String serviceName, ClassLoader classloader);
+   Future<SerializableStateTransferResult> getServiceState(String serviceName, ClassLoader classloader);
    
    /**
+    * Gets an input stream from which can be read the current service state from
+    * an existing member of the group.
+    * Intended to be called by newly joining members of the group.
+    * <p>
+    * Equivalent to <code>getServiceState(serviceName, null)</code>.
+    * </p>
+    * 
+    * @param serviceName the name of the service
+    * 
+    * @return <code>Future</code> whose {@link Future#get() get()} method will
+    *         return the service state when it becomes available.
+    */
+   Future<StreamStateTransferResult> getServiceStateAsStream(String serviceName);
+   
+   /**
     * Registers the object that can provide state for the service when
     * newly joining group members request it.
     * 

Added: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/SerializableStateTransferResult.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/SerializableStateTransferResult.java	                        (rev 0)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/SerializableStateTransferResult.java	2010-06-01 03:04:17 UTC (rev 105445)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.interfaces;
+
+import java.io.Serializable;
+
+/**
+ * A {@link StateTransferResult} that returns the state in deserialized form.
+ * 
+ * @author Brian Stansberry
+ * @version $Revision$
+ */
+public interface SerializableStateTransferResult extends StateTransferResult
+{
+   Serializable getState();
+}

Added: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StateTransferResult.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StateTransferResult.java	                        (rev 0)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StateTransferResult.java	2010-06-01 03:04:17 UTC (rev 105445)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.interfaces;
+
+/**
+ * Base interface encapsulating the result of a state transfer request. The
+ * subinterfaces provide the actual state.
+ * 
+ * @author Brian Stansberry
+ * @version $Revision$
+ */
+public interface StateTransferResult
+{
+   boolean stateReceived();
+   
+   Exception getStateTransferException();
+}

Added: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StateTransferStreamProvider.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StateTransferStreamProvider.java	                        (rev 0)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StateTransferStreamProvider.java	2010-06-01 03:04:17 UTC (rev 105445)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.interfaces;
+
+import java.io.OutputStream;
+
+/**
+ * Extends {@link StateTransferProvider} to add the capability of providing
+ * state by pushing it to an OutputStream.
+ * 
+ * @author Brian Stansberry
+ * @version $Revision$
+ */
+public interface StateTransferStreamProvider extends StateTransferProvider
+{
+   void getCurrentState(OutputStream out);
+}

Added: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StreamStateTransferResult.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StreamStateTransferResult.java	                        (rev 0)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StreamStateTransferResult.java	2010-06-01 03:04:17 UTC (rev 105445)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.interfaces;
+
+import java.io.InputStream;
+
+/**
+ * A {@link StateTransferResult} that returns the state as an input stream.
+ * 
+ * @author Brian Stansberry
+ * @version $Revision$
+ */
+public interface StreamStateTransferResult extends StateTransferResult
+{
+   InputStream getState();
+}




More information about the jboss-cvs-commits mailing list