activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r637454 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
Date Sat, 15 Mar 2008 18:59:57 GMT
Author: rajdavies
Date: Sat Mar 15 11:59:49 2008
New Revision: 637454

URL: http://svn.apache.org/viewvc?rev=637454&view=rev
Log:
Only unlock a service lock if we managed to lock it

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java?rev=637454&r1=637453&r2=637454&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
Sat Mar 15 11:59:49 2008
@@ -889,10 +889,11 @@
             new Thread("ActiveMQ Transport Stopper: "+ transport.getRemoteAddress()) {
                 @Override
                 public void run() {
+                    boolean locked = false;
                     // make sure we are not servicing client requests while we are shutting
down.
                     try {
                         //we could be waiting a long time if the network has gone - so only
wait 1 second
-                        serviceLock.writeLock().tryLock(1,TimeUnit.SECONDS);
+                        locked =  serviceLock.writeLock().tryLock(1,TimeUnit.SECONDS);
                     } catch (InterruptedException e) {
                        LOG.debug("Try get writeLock interrupted ",e);
                     }
@@ -903,7 +904,9 @@
                         LOG.debug("Error occured while shutting down a connection to '" +
transport.getRemoteAddress()+ "': ", e);
                     } finally {
                         stopped.countDown();
-                        serviceLock.writeLock().unlock();
+                        if (locked) {
+                            serviceLock.writeLock().unlock();
+                        }
                     }
                 }
             }.start();



Mime
View raw message