qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arnaudsi...@apache.org
Subject svn commit: r600860 - /incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/transport/network/mina/MinaSender.java
Date Tue, 04 Dec 2007 09:54:29 GMT
Author: arnaudsimon
Date: Tue Dec  4 01:54:28 2007
New Revision: 600860

URL: http://svn.apache.org/viewvc?rev=600860&view=rev
Log:
removed useless lock

Modified:
    incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/transport/network/mina/MinaSender.java

Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/transport/network/mina/MinaSender.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/transport/network/mina/MinaSender.java?rev=600860&r1=600859&r2=600860&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/transport/network/mina/MinaSender.java
(original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/transport/network/mina/MinaSender.java
Tue Dec  4 01:54:28 2007
@@ -30,15 +30,13 @@
 
 /**
  * MinaSender
- *
  */
 
 public class MinaSender implements Sender<java.nio.ByteBuffer>
 {
-    private static final int TIMEOUT = 2*60*1000;
+    private static final int TIMEOUT = 2 * 60 * 1000;
 
     private final IoSession session;
-    private final Object lock = new Object();
     private WriteFuture lastWrite = null;
 
     public MinaSender(IoSession session)
@@ -48,26 +46,20 @@
 
     public void send(java.nio.ByteBuffer buf)
     {
-        synchronized (lock)
+        if (session.isClosing())
         {
-            if( session.isClosing())
-            {
-                throw new RuntimeException("Trying to write on a closed socket");
-            }
-            lastWrite = session.write(ByteBuffer.wrap(buf));
+            throw new RuntimeException("Trying to write on a closed socket");
         }
+        lastWrite = session.write(ByteBuffer.wrap(buf));
     }
 
     public void close()
     {
         // MINA will sometimes throw away in-progress writes when you
         // ask it to close
-        synchronized (lock)
+        if (lastWrite != null)
         {
-            if (lastWrite != null)
-            {
-                lastWrite.join();
-            }
+            lastWrite.join();
         }
         CloseFuture closed = session.close();
         closed.join();



Mime
View raw message