activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [2/2] activemq-artemis git commit: ARTEMIS-1312 TimedBuffer doubled timeout with blocking flush
Date Tue, 01 Aug 2017 15:53:05 GMT
ARTEMIS-1312 TimedBuffer doubled timeout with blocking flush


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/74f243cc
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/74f243cc
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/74f243cc

Branch: refs/heads/master
Commit: 74f243cc4d9ec46f041e765148bdcb8be5af8b10
Parents: 14d840d
Author: Francesco Nigro <nigro.fra@gmail.com>
Authored: Tue Aug 1 14:52:07 2017 +0200
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Tue Aug 1 11:52:28 2017 -0400

----------------------------------------------------------------------
 .../org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java  | 2 +-
 .../artemis/tests/unit/core/journal/impl/TimedBufferTest.java    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/74f243cc/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
index b74ada4..6ed3e7b 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
@@ -395,7 +395,7 @@ public final class TimedBuffer {
             }
             //it could wait until the timeout is expired
             final long timeFromTheLastFlush = System.nanoTime() - lastFlushTime;
-            final long timeToSleep = timeFromTheLastFlush - timeout;
+            final long timeToSleep = timeout - timeFromTheLastFlush;
             if (timeToSleep > 0) {
                sleepIfPossible(timeToSleep);
             }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/74f243cc/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java
index 0e7f7c2..3cb8d2e 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java
@@ -385,7 +385,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
    @Test
    public void timeoutShouldMatchFlushIOPSWithNotBlockingFlush() {
       //use a large timeout in order to be reactive
-      final long timeout = TimeUnit.SECONDS.toNanos(2);
+      final long timeout = TimeUnit.MILLISECONDS.toNanos(100);
       assert ((int) timeout) > 0;
       //it is optimistic: the timeout and the blockingDeviceFlushTime are a perfect match
       final long deviceTime = timeout;
@@ -426,7 +426,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
    @Test
    public void timeoutShouldMatchFlushIOPSWithBlockingFlush() {
       //use a large timeout in order to be reactive
-      final long timeout = TimeUnit.SECONDS.toNanos(2);
+      final long timeout = TimeUnit.MILLISECONDS.toNanos(100);
       assert ((int) timeout) > 0;
       //it is optimistic: the timeout and the blockingDeviceFlushTime are a perfect match
       final long deviceTime = timeout;


Mime
View raw message