activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1149672 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOOutputStream.java
Date Fri, 22 Jul 2011 18:02:33 GMT
Author: tabish
Date: Fri Jul 22 18:02:32 2011
New Revision: 1149672

URL: http://svn.apache.org/viewvc?rev=1149672&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQ-2583 - nio+ssl initial implementation,
don't flip the buffer when its just a plain buffer without SSLEngine wrapping as it result
in setting the buffer position and limit to zero since that's where its position is already.
 This fixes the failing Stomp NIO tests.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOOutputStream.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOOutputStream.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOOutputStream.java?rev=1149672&r1=1149671&r2=1149672&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOOutputStream.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOOutputStream.java
Fri Jul 22 18:02:32 2011
@@ -26,14 +26,10 @@ import java.nio.channels.WritableByteCha
 import org.apache.activemq.transport.tcp.TimeStampStream;
 
 import javax.net.ssl.SSLEngine;
-import javax.net.ssl.SSLEngineResult;
 
 /**
  * An optimized buffered outputstream for Tcp
- * 
- * 
  */
-
 public class NIOOutputStream extends OutputStream implements TimeStampStream {
 
     private static final int BUFFER_SIZE = 8192;
@@ -50,7 +46,7 @@ public class NIOOutputStream extends Out
 
     /**
      * Constructor
-     * 
+     *
      * @param out
      */
     public NIOOutputStream(WritableByteChannel out) {
@@ -60,7 +56,7 @@ public class NIOOutputStream extends Out
     /**
      * Creates a new buffered output stream to write data to the specified
      * underlying output stream with the specified buffer size.
-     * 
+     *
      * @param out the underlying output stream.
      * @param size the buffer size.
      * @throws IllegalArgumentException if size <= 0.
@@ -76,7 +72,7 @@ public class NIOOutputStream extends Out
 
     /**
      * write a byte on to the stream
-     * 
+     *
      * @param b - byte to write
      * @throws IOException
      */
@@ -90,7 +86,7 @@ public class NIOOutputStream extends Out
 
     /**
      * write a byte array to the stream
-     * 
+     *
      * @param b the byte buffer
      * @param off the offset into the buffer
      * @param len the length of data to write
@@ -113,7 +109,7 @@ public class NIOOutputStream extends Out
      * flush the data to the output stream This doesn't call flush on the
      * underlying outputstream, because Tcp is particularly efficent at doing
      * this itself ....
-     * 
+     *
      * @throws IOException
      */
     public void flush() throws IOException {
@@ -127,7 +123,7 @@ public class NIOOutputStream extends Out
 
     /**
      * close this stream
-     * 
+     *
      * @throws IOException
      */
     public void close() throws IOException {
@@ -137,7 +133,7 @@ public class NIOOutputStream extends Out
 
     /**
      * Checks that the stream has not been closed
-     * 
+     *
      * @throws IOException
      */
     protected void checkClosed() throws IOException {
@@ -159,10 +155,10 @@ public class NIOOutputStream extends Out
             plain = ByteBuffer.allocate(engine.getSession().getPacketBufferSize());
             plain.clear();
             engine.wrap(data, plain);
+            plain.flip();
         }  else {
             plain = data;
         }
-        plain.flip();
         int remaining = plain.remaining();
         int lastRemaining = remaining - 1;
         long delay = 1;
@@ -197,15 +193,15 @@ public class NIOOutputStream extends Out
             writeTimestamp = -1;
         }
     }
-    
-    
+
+
     /* (non-Javadoc)
      * @see org.apache.activemq.transport.tcp.TimeStampStream#isWriting()
      */
     public boolean isWriting() {
         return writeTimestamp > 0;
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.activemq.transport.tcp.TimeStampStream#getWriteTimestamp()
      */



Mime
View raw message