[jboss-cvs] JBossAS SVN: r89150 - in trunk/cluster/src/main/org/jboss: ha/framework/server and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue May 19 23:03:18 EDT 2009
Author: david.lloyd at jboss.com
Date: 2009-05-19 23:03:17 -0400 (Tue, 19 May 2009)
New Revision: 89150
Modified:
trunk/cluster/src/main/org/jboss/ejb/plugins/CleanShutdownInterceptor.java
trunk/cluster/src/main/org/jboss/ha/framework/server/AsynchEventHandler.java
trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
trunk/cluster/src/main/org/jboss/ha/hasessionstate/server/HASessionStateImpl.java
trunk/cluster/src/main/org/jboss/invocation/unified/server/UnifiedInvokerHA.java
Log:
JBAS-6955 - wrong interrupt handling
Modified: trunk/cluster/src/main/org/jboss/ejb/plugins/CleanShutdownInterceptor.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ejb/plugins/CleanShutdownInterceptor.java 2009-05-20 02:59:45 UTC (rev 89149)
+++ trunk/cluster/src/main/org/jboss/ejb/plugins/CleanShutdownInterceptor.java 2009-05-20 03:03:17 UTC (rev 89150)
@@ -26,18 +26,17 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
+import org.jboss.ejb.Container;
+import org.jboss.ejb.EjbModule;
+import org.jboss.ha.framework.interfaces.GenericClusteringException;
+import org.jboss.invocation.Invocation;
+import org.jboss.system.ServiceMBean;
import javax.management.AttributeChangeNotification;
import javax.management.AttributeChangeNotificationFilter;
import javax.management.Notification;
import javax.management.NotificationListener;
-import org.jboss.ejb.Container;
-import org.jboss.ejb.EjbModule;
-import org.jboss.ha.framework.interfaces.GenericClusteringException;
-import org.jboss.invocation.Invocation;
-import org.jboss.system.ServiceMBean;
-
/**
* Track the incoming invocations and when shuting down a container (stop or
* destroy), waits for current invocations to finish before returning the
@@ -204,6 +203,7 @@
}
catch (java.lang.InterruptedException ie)
{
+ Thread.currentThread().interrupt();
throw new GenericClusteringException (GenericClusteringException.COMPLETED_NO,
"Container is shuting down on this node");
}
@@ -270,6 +270,7 @@
}
catch (java.lang.InterruptedException ie)
{
+ Thread.currentThread().interrupt();
throw new GenericClusteringException (GenericClusteringException.COMPLETED_NO,
"Container is shuting down on this node");
}
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/AsynchEventHandler.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/AsynchEventHandler.java 2009-05-20 02:59:45 UTC (rev 89149)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/AsynchEventHandler.java 2009-05-20 03:03:17 UTC (rev 89150)
@@ -95,35 +95,44 @@
{
log.debug("Begin " + name + " Thread");
stopped = false;
- while( !stopped )
+ boolean intr = false;
+ try
{
- try
+ while( !stopped )
{
- blocking = true;
- Object event = events.take();
- blocking = false;
-
- if (!stopped)
+ try
{
- processor.processEvent(event);
+ blocking = true;
+ Object event = events.take();
+ blocking = false;
+
+ if (!stopped)
+ {
+ processor.processEvent(event);
+ }
}
- }
- catch(InterruptedException e)
- {
- blocking = false;
- if (stopped)
+ catch(InterruptedException e)
{
- log.debug(name + " Thread interrupted");
- break;
+ intr = true;
+ blocking = false;
+ if (stopped)
+ {
+ log.debug(name + " Thread interrupted");
+ break;
+ }
+ log.error(name + " Thread interrupted", e);
}
- log.error(name + " Thread interrupted", e);
+ catch (Throwable t)
+ {
+ log.error("Caught Throwable handling asynch events", t);
+ }
}
- catch (Throwable t)
- {
- log.error("Caught Throwable handling asynch events", t);
- }
+ log.debug("End " + name + " Thread");
}
- log.debug("End " + name + " Thread");
+ finally
+ {
+ if (intr) Thread.currentThread().interrupt();
+ }
}
/**
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java 2009-05-20 02:59:45 UTC (rev 89149)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java 2009-05-20 03:03:17 UTC (rev 89150)
@@ -589,64 +589,74 @@
{
this.log.info("Fetching serviceState (will wait for " + this.getStateTransferTimeout() +
" milliseconds):");
- long start, stop;
- this.isStateSet = false;
- start = System.currentTimeMillis();
- boolean rc = this.channel.getState(null, this.getStateTransferTimeout());
- if (rc)
+ boolean intr = false;
+ try
{
- synchronized (this.channelLock)
+ long start, stop;
+ this.isStateSet = false;
+ start = System.currentTimeMillis();
+ boolean rc = this.channel.getState(null, this.getStateTransferTimeout());
+ if (rc)
{
- while (!this.isStateSet)
+ synchronized (this.channelLock)
{
- if (this.setStateException != null)
+ while (!this.isStateSet)
{
- throw this.setStateException;
- }
+ if (this.setStateException != null)
+ {
+ throw this.setStateException;
+ }
- try
- {
- this.channelLock.wait();
+ try
+ {
+ this.channelLock.wait();
+ }
+ catch (InterruptedException iex)
+ {
+ intr = true;
+ }
}
- catch (InterruptedException iex)
- {
- }
}
+ stop = System.currentTimeMillis();
+ this.log.info("serviceState was retrieved successfully (in " + (stop - start) + " milliseconds)");
}
- stop = System.currentTimeMillis();
- this.log.info("serviceState was retrieved successfully (in " + (stop - start) + " milliseconds)");
- }
- else
- {
- // No one provided us with serviceState.
- // We need to find out if we are the coordinator, so we must
- // block until viewAccepted() is called at least once
+ else
+ {
+ // No one provided us with serviceState.
+ // We need to find out if we are the coordinator, so we must
+ // block until viewAccepted() is called at least once
- synchronized (this.members)
- {
- while (this.members.size() == 0)
+ synchronized (this.members)
{
- this.log.debug("waiting on viewAccepted()");
- try
+ while (this.members.size() == 0)
{
- this.members.wait();
+ this.log.debug("waiting on viewAccepted()");
+ try
+ {
+ this.members.wait();
+ }
+ catch (InterruptedException iex)
+ {
+ intr = true;
+ }
}
- catch (InterruptedException iex)
- {
- }
}
- }
- if (this.isCurrentNodeCoordinator())
- {
- this.log.info("State could not be retrieved (we are the first member in group)");
+ if (this.isCurrentNodeCoordinator())
+ {
+ this.log.info("State could not be retrieved (we are the first member in group)");
+ }
+ else
+ {
+ throw new IllegalStateException("Initial serviceState transfer failed: " +
+ "Channel.getState() returned false");
+ }
}
- else
- {
- throw new IllegalStateException("Initial serviceState transfer failed: " +
- "Channel.getState() returned false");
- }
}
+ finally
+ {
+ if (intr) Thread.currentThread().interrupt();
+ }
}
private void getStateInternal(OutputStream stream) throws IOException
@@ -912,34 +922,43 @@
private void waitForView() throws Exception
{
- synchronized (this.channelLock)
+ boolean intr = false;
+ try
{
- if (this.members == null)
+ synchronized (this.channelLock)
{
- if (this.connectException != null)
- {
- throw this.connectException;
- }
-
- try
- {
- this.channelLock.wait(this.getMethodCallTimeout());
- }
- catch (InterruptedException iex)
- {
- }
-
- if (this.connectException != null)
- {
- throw this.connectException;
- }
-
if (this.members == null)
{
- throw new IllegalStateException("No view received from Channel");
+ if (this.connectException != null)
+ {
+ throw this.connectException;
+ }
+
+ try
+ {
+ this.channelLock.wait(this.getMethodCallTimeout());
+ }
+ catch (InterruptedException iex)
+ {
+ intr = true;
+ }
+
+ if (this.connectException != null)
+ {
+ throw this.connectException;
+ }
+
+ if (this.members == null)
+ {
+ throw new IllegalStateException("No view received from Channel");
+ }
}
}
}
+ finally
+ {
+ if (intr) Thread.currentThread().interrupt();
+ }
}
// HAPartition implementation ----------------------------------------------
Modified: trunk/cluster/src/main/org/jboss/ha/hasessionstate/server/HASessionStateImpl.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/hasessionstate/server/HASessionStateImpl.java 2009-05-20 02:59:45 UTC (rev 89149)
+++ trunk/cluster/src/main/org/jboss/ha/hasessionstate/server/HASessionStateImpl.java 2009-05-20 03:03:17 UTC (rev 89150)
@@ -369,6 +369,7 @@
}
catch (InterruptedException ie)
{
+ Thread.currentThread().interrupt();
this.log.info(ie);
return;
}
Modified: trunk/cluster/src/main/org/jboss/invocation/unified/server/UnifiedInvokerHA.java
===================================================================
--- trunk/cluster/src/main/org/jboss/invocation/unified/server/UnifiedInvokerHA.java 2009-05-20 02:59:45 UTC (rev 89149)
+++ trunk/cluster/src/main/org/jboss/invocation/unified/server/UnifiedInvokerHA.java 2009-05-20 03:03:17 UTC (rev 89150)
@@ -184,7 +184,6 @@
finally
{
currentThread.setContextClassLoader(oldCl);
- Thread.interrupted(); // clear interruption because this thread may be pooled.
}
}
More information about the jboss-cvs-commits
mailing list