[jboss-cvs] JBossAS SVN: r105446 - projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/framework/server.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon May 31 23:05:11 EDT 2010
Author: bstansberry at jboss.com
Date: 2010-05-31 23:05:10 -0400 (Mon, 31 May 2010)
New Revision: 105446
Modified:
projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/framework/server/HAPartitionImpl.java
Log:
Utilize improved state transfer handling
Modified: projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/framework/server/HAPartitionImpl.java
===================================================================
--- projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/framework/server/HAPartitionImpl.java 2010-06-01 03:04:17 UTC (rev 105445)
+++ projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/framework/server/HAPartitionImpl.java 2010-06-01 03:05:10 UTC (rev 105446)
@@ -27,11 +27,13 @@
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
import org.jboss.ha.framework.interfaces.ClusterNode;
import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
import org.jboss.ha.framework.interfaces.GroupMembershipListener;
import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.interfaces.SerializableStateTransferResult;
import org.jboss.ha.framework.interfaces.StateTransferProvider;
//import org.jboss.ha.framework.server.spi.ManagedDistributedState;
@@ -261,15 +263,32 @@
@SuppressWarnings("deprecation")
private void fetchInitialState() throws Exception
{
- this.log.info("Fetching serviceState (will wait for " + this.getStateTransferTimeout() +
+ this.log.info("Fetching initial service state (will wait for " + this.getStateTransferTimeout() +
" milliseconds for each service):");
for (Map.Entry<String, HAPartitionStateTransfer> entry : this.initialStateRecipients.entrySet())
{
try
{
- Future<Serializable> future = this.getServiceState(entry.getKey());
- entry.getValue().setCurrentState(future.get());
+ log.debug("Fetching state for " + entry.getKey());
+ Future<SerializableStateTransferResult> future = this.getServiceState(entry.getKey());
+ SerializableStateTransferResult result = future.get(this.getStateTransferTimeout(), TimeUnit.MILLISECONDS);
+ if (result.stateReceived())
+ {
+ if (result.getStateTransferException() != null)
+ {
+ throw result.getStateTransferException();
+ }
+ else
+ {
+ entry.getValue().setCurrentState(result.getState());
+ log.debug("Received state for " + entry.getKey());
+ }
+ }
+ else
+ {
+ log.debug("No state available for " + entry.getKey() + " -- we must be sole member of group");
+ }
}
catch (Exception e)
{
More information about the jboss-cvs-commits
mailing list