[jboss-cvs] JBossAS SVN: r89149 - trunk/tomcat/src/main/org/jboss/web/tomcat/service/session.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 19 22:59:45 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-05-19 22:59:45 -0400 (Tue, 19 May 2009)
New Revision: 89149

Modified:
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/IntervalSnapshotManager.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
Log:
JBAS-6954 - improper interrupt handling

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/IntervalSnapshotManager.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/IntervalSnapshotManager.java	2009-05-20 02:57:37 UTC (rev 89148)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/IntervalSnapshotManager.java	2009-05-20 02:59:45 UTC (rev 89149)
@@ -159,20 +159,29 @@
     */
    protected void stopThread()
    {
-      if (thread == null)
-      {
-         return;
-      }
-      threadDone = true;
-      thread.interrupt();
+      boolean intr = false;
       try
       {
-         thread.join();
+         if (thread == null)
+         {
+            return;
+         }
+         threadDone = true;
+         thread.interrupt();
+         try
+         {
+            thread.join();
+         }
+         catch (InterruptedException e)
+         {
+            intr = true;
+         }
+         thread = null;
       }
-      catch (InterruptedException e)
+      finally
       {
+         if (intr) Thread.currentThread().interrupt();
       }
-      thread = null;
    }
 
    /**
@@ -180,22 +189,31 @@
     */
    public void run()
    {
-      while (!threadDone)
+      boolean intr = false;
+      try
       {
-         try
+         while (!threadDone)
          {
-            Thread.sleep(interval);
-            processSessions();
+            try
+            {
+               Thread.sleep(interval);
+               processSessions();
+            }
+            catch (InterruptedException ie)
+            {
+               Thread.currentThread().interrupt();
+               if (!threadDone)
+                  getLog().error("Caught exception processing sessions", ie);
+            }
+            catch (Exception e)
+            {
+               getLog().error("Caught exception processing sessions", e);
+            }
          }
-         catch (InterruptedException ie)
-         {
-            if (!threadDone)
-               getLog().error("Caught exception processing sessions", ie);
-         }
-         catch (Exception e)
-         {
-            getLog().error("Caught exception processing sessions", e);
-         }
       }
+      finally
+      {
+         if (intr) Thread.currentThread().interrupt();
+      }
    }
 }

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java	2009-05-20 02:57:37 UTC (rev 89148)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java	2009-05-20 02:59:45 UTC (rev 89149)
@@ -701,8 +701,8 @@
          }
          catch (InterruptedException e)
          {
+            Thread.currentThread().interrupt();
             this.semaphore.release();
-            
             throw new LifecycleException(e);
          }
       }




More information about the jboss-cvs-commits mailing list