You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2017/09/22 15:55:43 UTC
[1/2] activemq-artemis git commit: ARTEMIS-1434: update handling of
tick deadline values
Repository: activemq-artemis
Updated Branches:
refs/heads/master 8160be008 -> b893042d8
ARTEMIS-1434: update handling of tick deadline values
- account for potential to be negative due to using nanoTime derived values
- add some other edge case protections to avoid task ceasing in error
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/1a077348
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/1a077348
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/1a077348
Branch: refs/heads/master
Commit: 1a077348e2d06a541f2ef6cc94342a299220ff72
Parents: 8160be0
Author: Robbie Gemmell <ro...@apache.org>
Authored: Fri Sep 22 16:33:21 2017 +0100
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Fri Sep 22 16:33:21 2017 +0100
----------------------------------------------------------------------
.../protocol/amqp/proton/AMQPConnectionContext.java | 8 ++++----
.../transport/amqp/client/AmqpConnection.java | 14 +++++++-------
2 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1a077348/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java
index 47cb11d..680111a 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java
@@ -387,13 +387,13 @@ public class AMQPConnectionContext extends ProtonInitializable implements EventH
* */
if (connection.getRemoteProperties() == null || !connection.getRemoteProperties().containsKey(CONNECTION_OPEN_FAILED)) {
long nextKeepAliveTime = handler.tick(true);
- if (nextKeepAliveTime > 0 && scheduledPool != null) {
+ if (nextKeepAliveTime != 0 && scheduledPool != null) {
scheduledPool.schedule(new Runnable() {
@Override
public void run() {
- long rescheduleAt = (handler.tick(false) - TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
- if (rescheduleAt > 0) {
- scheduledPool.schedule(this, rescheduleAt, TimeUnit.MILLISECONDS);
+ long rescheduleAt = handler.tick(false);
+ if (rescheduleAt != 0) {
+ scheduledPool.schedule(this, rescheduleAt - TimeUnit.NANOSECONDS.toMillis(System.nanoTime()), TimeUnit.MILLISECONDS);
}
}
}, (nextKeepAliveTime - TimeUnit.NANOSECONDS.toMillis(System.nanoTime())), TimeUnit.MILLISECONDS);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1a077348/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
----------------------------------------------------------------------
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
index 84e7ba1..2fc720a 100644
--- a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
@@ -606,7 +606,7 @@ public class AmqpConnection extends AmqpAbstractResource<Connection> implements
// Using nano time since it is not related to the wall clock, which may change
long initialNow = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
long initialKeepAliveDeadline = protonTransport.tick(initialNow);
- if (initialKeepAliveDeadline > 0) {
+ if (initialKeepAliveDeadline != 0) {
getScheduler().schedule(new Runnable() {
@@ -617,15 +617,15 @@ public class AmqpConnection extends AmqpAbstractResource<Connection> implements
LOG.debug("Client performing next idle check");
// Using nano time since it is not related to the wall clock, which may change
long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
- long rescheduleAt = protonTransport.tick(now) - now;
+ long deadline = protonTransport.tick(now);
pumpToProtonTransport();
if (protonTransport.isClosed()) {
LOG.debug("Transport closed after inactivity check.");
- throw new InactivityIOException("Channel was inactive for to long");
- }
-
- if (rescheduleAt > 0) {
- getScheduler().schedule(this, rescheduleAt, TimeUnit.MILLISECONDS);
+ throw new InactivityIOException("Channel was inactive for too long");
+ } else {
+ if (deadline != 0) {
+ getScheduler().schedule(this, deadline - now, TimeUnit.MILLISECONDS);
+ }
}
}
} catch (Exception e) {
[2/2] activemq-artemis git commit: This closes #1548
Posted by ta...@apache.org.
This closes #1548
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/b893042d
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/b893042d
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/b893042d
Branch: refs/heads/master
Commit: b893042d8da7c2c869c34f2ea6f43ed55713f474
Parents: 8160be0 1a07734
Author: Timothy Bish <ta...@gmail.com>
Authored: Fri Sep 22 11:55:25 2017 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Fri Sep 22 11:55:25 2017 -0400
----------------------------------------------------------------------
.../protocol/amqp/proton/AMQPConnectionContext.java | 8 ++++----
.../transport/amqp/client/AmqpConnection.java | 14 +++++++-------
2 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------