You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2015/10/02 16:04:11 UTC

[1/3] qpid-jms git commit: QPIDJMS-112: remove stale TODO, already handled elsewhere

Repository: qpid-jms
Updated Branches:
  refs/heads/master d0e5ae1ab -> f77a459a6


QPIDJMS-112: remove stale TODO, already handled elsewhere


Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/f82bf503
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/f82bf503
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/f82bf503

Branch: refs/heads/master
Commit: f82bf5032bceab98d87f9ac5c8a5a9c3163d112c
Parents: d0e5ae1
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Oct 2 14:16:25 2015 +0100
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Oct 2 14:58:53 2015 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java       | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f82bf503/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
index 98a2bc5..2abc788 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
@@ -290,7 +290,6 @@ public class JmsMessageConsumer implements MessageConsumer, JmsMessageAvailableC
                         timeout = Math.max(deadline - System.currentTimeMillis(), 0);
                     }
 
-                    //TODO: don't do this if stopped, etc
                     //TODO: make it optional/configurable not to do this at all?
                     if (timeout >= 0) {
                         // We don't do this for receive with no timeout since it


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[3/3] qpid-jms git commit: NO-JIRA: remove unused imports

Posted by ro...@apache.org.
NO-JIRA: remove unused imports


Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/f77a459a
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/f77a459a
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/f77a459a

Branch: refs/heads/master
Commit: f77a459a610a77eabdf8b777020b2635712c818a
Parents: 301e32d
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Oct 2 14:37:25 2015 +0100
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Oct 2 15:03:03 2015 +0100

----------------------------------------------------------------------
 .../org/apache/qpid/jms/integration/ConsumerIntegrationTest.java   | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f77a459a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java
index 6d91096..4dd66c5 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java
@@ -20,7 +20,6 @@ package org.apache.qpid.jms.integration;
 
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.notNullValue;
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -29,7 +28,6 @@ import static org.junit.Assert.fail;
 import java.io.IOException;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.jms.Connection;
 import javax.jms.IllegalStateException;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[2/3] qpid-jms git commit: QPIDJMS-118, QPIDJMS-116: ensure the loop checks the expected conditions have been satisified before continuing, ensure we actually wait for the given timeout where appropriate

Posted by ro...@apache.org.
QPIDJMS-118, QPIDJMS-116: ensure the loop checks the expected conditions have been satisified before continuing, ensure we actually wait for the given timeout where appropriate


Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/301e32d6
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/301e32d6
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/301e32d6

Branch: refs/heads/master
Commit: 301e32d69552bc183fadee471c45a1717a6347f1
Parents: f82bf50
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Oct 2 14:32:44 2015 +0100
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Oct 2 15:00:36 2015 +0100

----------------------------------------------------------------------
 .../qpid/jms/util/AbstractMessageQueue.java     |  3 +-
 .../qpid/jms/util/FifoMessageQueueTest.java     | 37 +++++++++++++++++-
 .../qpid/jms/util/PriorityMessageQueueTest.java | 41 ++++++++++----------
 3 files changed, 58 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/301e32d6/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java
index 18f6991..0b69290 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java
@@ -43,8 +43,9 @@ public abstract class AbstractMessageQueue implements MessageQueue {
                 if (timeout == -1) {
                     lock.wait();
                 } else {
+                    long start = System.currentTimeMillis();
                     lock.wait(timeout);
-                    break;
+                    timeout = Math.max(timeout + start - System.currentTimeMillis(), 0);
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/301e32d6/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/FifoMessageQueueTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/FifoMessageQueueTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/FifoMessageQueueTest.java
index 4a34918..8235478 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/FifoMessageQueueTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/FifoMessageQueueTest.java
@@ -278,13 +278,48 @@ public class FifoMessageQueueTest {
     }
 
     @Test(timeout = 10000)
+    public void testDequeueWaitsUntilMessageArrivesWhenLockNotified() throws InterruptedException {
+        doDequeueWaitsUntilMessageArrivesWhenLockNotifiedTestImpl(-1);
+    }
+
+    @Test(timeout = 10000)
+    public void testTimedDequeueWaitsUntilMessageArrivesWhenLockNotified() throws InterruptedException {
+        doDequeueWaitsUntilMessageArrivesWhenLockNotifiedTestImpl(100000);
+    }
+
+    private void doDequeueWaitsUntilMessageArrivesWhenLockNotifiedTestImpl(int timeout) throws InterruptedException {
+        final JmsInboundMessageDispatch message = createEnvelope();
+        Thread runner = new Thread(new Runnable() {
+
+            @Override
+            public void run() {
+                try {
+                    TimeUnit.MILLISECONDS.sleep(100);
+                } catch (InterruptedException e) {
+                }
+                synchronized (queue.getLock()) {
+                    queue.getLock().notify();
+                }
+                try {
+                    TimeUnit.MILLISECONDS.sleep(100);
+                } catch (InterruptedException e) {
+                }
+                queue.enqueueFirst(message);
+            }
+        });
+        runner.start();
+
+        assertSame(message, queue.dequeue(timeout));
+    }
+
+    @Test(timeout = 10000)
     public void testDequeueReturnsWhenQueueIsStopped() throws InterruptedException {
         Thread runner = new Thread(new Runnable() {
 
             @Override
             public void run() {
                 try {
-                    TimeUnit.MILLISECONDS.sleep(500);
+                    TimeUnit.MILLISECONDS.sleep(100);
                 } catch (InterruptedException e) {
                 }
                 queue.stop();

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/301e32d6/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/PriorityMessageQueueTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/PriorityMessageQueueTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/PriorityMessageQueueTest.java
index 1b46092..b62043e 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/PriorityMessageQueueTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/PriorityMessageQueueTest.java
@@ -285,32 +285,22 @@ public class PriorityMessageQueueTest {
 
     @Test(timeout = 10000)
     public void testDequeueWaitsUntilMessageArrives() throws InterruptedException {
-        final JmsInboundMessageDispatch message = createEnvelope();
-        Thread runner = new Thread(new Runnable() {
-
-            @Override
-            public void run() {
-                try {
-                    TimeUnit.MILLISECONDS.sleep(200);
-                } catch (InterruptedException e) {
-                }
-                queue.enqueueFirst(message);
-            }
-        });
-        runner.start();
-
-        assertSame(message, queue.dequeue(-1));
+        doDequeueWaitsUntilMessageArrivesTestImpl(-1);
     }
 
     @Test(timeout = 10000)
     public void testDequeueTimedWaitsUntilMessageArrives() throws InterruptedException {
+        doDequeueWaitsUntilMessageArrivesTestImpl(5000);
+    }
+
+    private void doDequeueWaitsUntilMessageArrivesTestImpl(int timeout) throws InterruptedException {
         final JmsInboundMessageDispatch message = createEnvelope();
         Thread runner = new Thread(new Runnable() {
 
             @Override
             public void run() {
                 try {
-                    TimeUnit.MILLISECONDS.sleep(500);
+                    TimeUnit.MILLISECONDS.sleep(100);
                 } catch (InterruptedException e) {
                 }
                 queue.enqueueFirst(message);
@@ -318,25 +308,34 @@ public class PriorityMessageQueueTest {
         });
         runner.start();
 
-        assertSame(message, queue.dequeue(5000));
+        assertSame(message, queue.dequeue(timeout));
     }
 
     @Test(timeout = 10000)
     public void testDequeueWaitsUntilMessageArrivesWhenLockNotified() throws InterruptedException {
+        doDequeueWaitsUntilMessageArrivesWhenLockNotifiedTestImpl(-1);
+    }
+
+    @Test(timeout = 10000)
+    public void testTimedDequeueWaitsUntilMessageArrivesWhenLockNotified() throws InterruptedException {
+        doDequeueWaitsUntilMessageArrivesWhenLockNotifiedTestImpl(100000);
+    }
+
+    private void doDequeueWaitsUntilMessageArrivesWhenLockNotifiedTestImpl(int timeout) throws InterruptedException {
         final JmsInboundMessageDispatch message = createEnvelope();
         Thread runner = new Thread(new Runnable() {
 
             @Override
             public void run() {
                 try {
-                    TimeUnit.MILLISECONDS.sleep(200);
+                    TimeUnit.MILLISECONDS.sleep(100);
                 } catch (InterruptedException e) {
                 }
                 synchronized (queue.getLock()) {
                     queue.getLock().notify();
                 }
                 try {
-                    TimeUnit.MILLISECONDS.sleep(200);
+                    TimeUnit.MILLISECONDS.sleep(100);
                 } catch (InterruptedException e) {
                 }
                 queue.enqueueFirst(message);
@@ -344,7 +343,7 @@ public class PriorityMessageQueueTest {
         });
         runner.start();
 
-        assertSame(message, queue.dequeue(-1));
+        assertSame(message, queue.dequeue(timeout));
     }
 
     @Test(timeout = 10000)
@@ -354,7 +353,7 @@ public class PriorityMessageQueueTest {
             @Override
             public void run() {
                 try {
-                    TimeUnit.MILLISECONDS.sleep(500);
+                    TimeUnit.MILLISECONDS.sleep(100);
                 } catch (InterruptedException e) {
                 }
                 queue.stop();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org