[jboss-cvs] JBossAS SVN: r76671 - in trunk/cluster: src/main/org/jboss/ejb/plugins and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 5 12:18:21 EDT 2008


Author: pferraro
Date: 2008-08-05 12:18:21 -0400 (Tue, 05 Aug 2008)
New Revision: 76671

Modified:
   trunk/cluster/pom.xml
   trunk/cluster/src/main/org/jboss/ejb/plugins/CleanShutdownInterceptor.java
   trunk/cluster/src/main/org/jboss/ha/framework/server/AsynchEventHandler.java
Log:
Replaced object from Doug Lea's concurrent package with java.util.concurrent equivalents.
Dropped obsolete dependency on concurrent package.

Modified: trunk/cluster/pom.xml
===================================================================
--- trunk/cluster/pom.xml	2008-08-05 16:17:01 UTC (rev 76670)
+++ trunk/cluster/pom.xml	2008-08-05 16:18:21 UTC (rev 76671)
@@ -122,11 +122,6 @@
     </dependency>
     
     <dependency>
-      <groupId>oswego-concurrent</groupId>
-      <artifactId>concurrent</artifactId>
-    </dependency>
-    
-    <dependency>
       <groupId>javax.transaction</groupId>
       <artifactId>jta</artifactId>
     </dependency>

Modified: trunk/cluster/src/main/org/jboss/ejb/plugins/CleanShutdownInterceptor.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ejb/plugins/CleanShutdownInterceptor.java	2008-08-05 16:17:01 UTC (rev 76670)
+++ trunk/cluster/src/main/org/jboss/ejb/plugins/CleanShutdownInterceptor.java	2008-08-05 16:18:21 UTC (rev 76671)
@@ -21,17 +21,21 @@
   */
 package org.jboss.ejb.plugins;
 
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+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.ha.framework.interfaces.GenericClusteringException;
-import EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock;
-import org.jboss.ejb.EjbModule;
-import javax.management.NotificationListener;
-import javax.management.Notification;
-import javax.management.AttributeChangeNotification;
-import javax.management.AttributeChangeNotificationFilter;
-import java.util.Collection;
-import java.util.Iterator;
 import org.jboss.system.ServiceMBean;
 
 /**
@@ -72,7 +76,7 @@
    protected EjbModule ejbModule = null;
    protected String ejbModuleName = null;
    
-   private static ThreadLocal currentModule = new ThreadLocal ();
+   private static ThreadLocal<String> currentModule = new ThreadLocal<String>();
    
    protected boolean allowInvocations = false;
    protected boolean allowRemoteInvocations = false;
@@ -84,7 +88,7 @@
    public long shutdownTimeout = 60000;
    public long readAcquireTimeMs = 10000;
 
-   protected ReentrantWriterPreferenceReadWriteLock rwLock = new ReentrantWriterPreferenceReadWriteLock();
+   protected ReadWriteLock rwLock = new ReentrantReadWriteLock(true);
 
    // Static --------------------------------------------------------
    
@@ -193,7 +197,7 @@
          {
             if (!isAppLocalCall) // we only consider remote calls => every local originates from a remote!
             {
-               if (!rwLock.readLock ().attempt (readAcquireTimeMs))
+               if (!rwLock.readLock().tryLock(readAcquireTimeMs, TimeUnit.MILLISECONDS))
                   throw new GenericClusteringException (GenericClusteringException.COMPLETED_NO,
                                                         "Container is shuting down on this node (timeout)");
             }
@@ -227,7 +231,7 @@
             
             runningHomeInvocations--;
             if (!isAppLocalCall) // we only consider remote calls => every local originates from a remote!
-               rwLock.readLock ().release ();
+               rwLock.readLock().unlock();
          }
       }
       else
@@ -259,7 +263,7 @@
          {
             if (!isAppLocalCall) // we only consider remote calls => every local originates from a remote!
             {
-               if (!rwLock.readLock ().attempt (readAcquireTimeMs))
+               if (!rwLock.readLock ().tryLock(readAcquireTimeMs, TimeUnit.MILLISECONDS))
                   throw new GenericClusteringException (GenericClusteringException.COMPLETED_NO,
                                                         "Container is shuting down on this node (timeout)");
             }
@@ -293,7 +297,7 @@
 
             runningInvocations--;
             if (!isAppLocalCall) // we only consider remote calls => every local originates from a remote!
-               rwLock.readLock ().release ();
+               rwLock.readLock().unlock();
          }
       }
       else
@@ -334,8 +338,8 @@
    {
       try
       {
-         if (this.rwLock.writeLock ().attempt (shutdownTimeout))
-            this.rwLock.writeLock ().release ();
+         if (this.rwLock.writeLock().tryLock(shutdownTimeout, TimeUnit.MILLISECONDS))
+            this.rwLock.writeLock().unlock();
          else
             log.info ("Possible running invocations not terminated " + 
                "while leaving the container. Home: " + runningHomeInvocations +
@@ -355,7 +359,7 @@
    
    protected String getOrigin (Invocation mi)
    {
-      String value = (String)currentModule.get ();
+      String value = currentModule.get();
       if (log.isTraceEnabled())
          log.trace ("GET_ORIGIN: " + value + " in " + this.container.getServiceName ().toString ());
       return value; 
@@ -363,7 +367,7 @@
    
    protected void setOrigin (Invocation mi)
    {      
-      currentModule.set (this.ejbModuleName);
+      currentModule.set(this.ejbModuleName);
    }
       
    protected void revertOrigin (Invocation mi, String origin)

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/AsynchEventHandler.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/AsynchEventHandler.java	2008-08-05 16:17:01 UTC (rev 76670)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/AsynchEventHandler.java	2008-08-05 16:18:21 UTC (rev 76671)
@@ -21,10 +21,11 @@
 */
 package org.jboss.ha.framework.server;
 
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
 import org.jboss.logging.Logger;
 
-import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
-
 /**
  * Utility class that accepts objects into a queue and maintains a separate
  * thread that reads them off the queue and passes them to a registered
@@ -48,7 +49,7 @@
    
    private String name;
    /** The LinkedQueue of events to pass to our processor */
-   private LinkedQueue events = new LinkedQueue();
+   private BlockingQueue<Object> events = new LinkedBlockingQueue<Object>();
    /** Whether we're blocking on the queue */
    private boolean blocking;
    private AsynchEventProcessor processor;
@@ -87,7 +88,7 @@
    public void queueEvent(Object event) throws InterruptedException
    {
       if (event != null)
-         events.put(event);
+         events.add(event);
    }
    
    public void run()




More information about the jboss-cvs-commits mailing list