mina-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r635916 - in /mina/trunk/core/src: main/java/org/apache/mina/transport/vmpipe/VmPipeFilterChain.java test/java/org/apache/mina/transport/vmpipe/VmPipeEventOrderTest.java
Date Tue, 11 Mar 2008 13:12:56 GMT
Author: trustin
Date: Tue Mar 11 06:12:54 2008
New Revision: 635916

URL: http://svn.apache.org/viewvc?rev=635916&view=rev
Log:
Fixed intermittantly failing VmPipeExecutorOrderTest


Modified:
    mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeFilterChain.java
    mina/trunk/core/src/test/java/org/apache/mina/transport/vmpipe/VmPipeEventOrderTest.java

Modified: mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeFilterChain.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeFilterChain.java?rev=635916&r1=635915&r2=635916&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeFilterChain.java
(original)
+++ mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeFilterChain.java
Tue Mar 11 06:12:54 2008
@@ -113,6 +113,7 @@
                 session.getLock().unlock();
             }
         } else if (type == IoEventType.SESSION_CLOSED) {
+            flushPendingDataQueues(session);
             super.fireSessionClosed();
         } else if (type == IoEventType.CLOSE) {
             super.fireFilterClose();
@@ -172,12 +173,12 @@
     private class VmPipeIoProcessor implements IoProcessor<VmPipeSessionImpl> {
         public void flush(VmPipeSessionImpl session) {
             WriteRequestQueue queue = session.getWriteRequestQueue0();
-            if (queue.isEmpty(session)) {
-                return;
-            }
-            if (session.isConnected()) {
+            if (!session.isClosing()) {
                 session.getLock().lock();
                 try {
+                    if (queue.isEmpty(session)) {
+                        return;
+                    }
                     WriteRequest req;
                     while ((req = queue.poll(session)) != null) {
                         session.getRemoteSession().getFilterChain().fireMessageReceived(

Modified: mina/trunk/core/src/test/java/org/apache/mina/transport/vmpipe/VmPipeEventOrderTest.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/test/java/org/apache/mina/transport/vmpipe/VmPipeEventOrderTest.java?rev=635916&r1=635915&r2=635916&view=diff
==============================================================================
--- mina/trunk/core/src/test/java/org/apache/mina/transport/vmpipe/VmPipeEventOrderTest.java
(original)
+++ mina/trunk/core/src/test/java/org/apache/mina/transport/vmpipe/VmPipeEventOrderTest.java
Tue Mar 11 06:12:54 2008
@@ -204,6 +204,12 @@
         });
         ConnectFuture connectFuture = vmPipeConnector.connect(vmPipeAddress);
         connectFuture.awaitUninterruptibly();
+        
+        // Wait until one byte is written.
+        while (connectFuture.getSession().getWrittenBytes() == 0) {
+            Thread.yield();
+        }
+        
         connectFuture.getSession().close();
         semaphore.tryAcquire(1, TimeUnit.SECONDS);
         vmPipeAcceptor.unbind(vmPipeAddress);



Mime
View raw message