qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ai...@apache.org
Subject svn commit: r805809 - in /qpid/branches/java-network-refactor/qpid/java/common/src/main/java/org/apache/qpid/transport: NetworkDriver.java network/mina/MINANetworkDriver.java
Date Wed, 19 Aug 2009 14:03:25 GMT
Author: aidan
Date: Wed Aug 19 14:03:25 2009
New Revision: 805809

URL: http://svn.apache.org/viewvc?rev=805809&view=rev
Log:
QPID-2024: Change send to stash the future and have flush join on that so that it only returns
when all data has been written.

Add getLocalAddress.


Modified:
    qpid/branches/java-network-refactor/qpid/java/common/src/main/java/org/apache/qpid/transport/NetworkDriver.java
    qpid/branches/java-network-refactor/qpid/java/common/src/main/java/org/apache/qpid/transport/network/mina/MINANetworkDriver.java

Modified: qpid/branches/java-network-refactor/qpid/java/common/src/main/java/org/apache/qpid/transport/NetworkDriver.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/java/common/src/main/java/org/apache/qpid/transport/NetworkDriver.java?rev=805809&r1=805808&r2=805809&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/java/common/src/main/java/org/apache/qpid/transport/NetworkDriver.java
(original)
+++ qpid/branches/java-network-refactor/qpid/java/common/src/main/java/org/apache/qpid/transport/NetworkDriver.java
Wed Aug 19 14:03:25 2009
@@ -43,9 +43,12 @@
    void bind (int port, InetAddress[] addresses, ProtocolEngineFactory protocolFactory, 

               NetworkDriverConfiguration config, SSLContextFactory sslFactory) throws BindException;

  
-   // Returns the remote address of underlying socket 
+   // Returns the remote address of the underlying socket 
    SocketAddress getRemoteAddress();
  
+   // Returns the local address of the underlying socket
+   SocketAddress getLocalAddress();
+   
    /**
     * The length of time after which the ProtocolEngines readIdle() method should be called
if no data has been 
     * read in seconds

Modified: qpid/branches/java-network-refactor/qpid/java/common/src/main/java/org/apache/qpid/transport/network/mina/MINANetworkDriver.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/java/common/src/main/java/org/apache/qpid/transport/network/mina/MINANetworkDriver.java?rev=805809&r1=805808&r2=805809&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/java/common/src/main/java/org/apache/qpid/transport/network/mina/MINANetworkDriver.java
(original)
+++ qpid/branches/java-network-refactor/qpid/java/common/src/main/java/org/apache/qpid/transport/network/mina/MINANetworkDriver.java
Wed Aug 19 14:03:25 2009
@@ -78,6 +78,8 @@
     private Throwable _lastException;
     private boolean _acceptingConnections = false;
 
+    private WriteFuture _lastWriteFuture;
+
     public MINANetworkDriver(boolean useNIO, int processors, boolean executorPool, boolean
protectIO)
     {
         _useNIO = useNIO;
@@ -174,6 +176,11 @@
     {
         return _ioSession.getRemoteAddress();
     }
+    
+    public SocketAddress getLocalAddress()
+    {
+        return _ioSession.getLocalAddress();
+    }
 
     public void open(int port, InetAddress destination, ProtocolEngine engine, NetworkDriverConfiguration
config,
             SSLEngine sslEngine) throws OpenException
@@ -256,13 +263,15 @@
 
     public void flush()
     {
-        // MINA doesn't support flush 
+        if (_lastWriteFuture != null)
+        {
+            _lastWriteFuture.join();
+        }
     }
 
     public void send(ByteBuffer msg)
     {
-        WriteFuture future = _ioSession.write(org.apache.mina.common.ByteBuffer.wrap(msg));
-        future.join();
+        _lastWriteFuture = _ioSession.write(org.apache.mina.common.ByteBuffer.wrap(msg));
     }
 
     public void setIdleTimeout(long l)



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message