You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2014/01/22 00:11:36 UTC
git commit: THRIFT-2108 java: Fix TAsyncClientManager timeout race
Patch: Vadim Spivak
Updated Branches:
refs/heads/master 9aa08a9f6 -> 194f0114c
THRIFT-2108 java: Fix TAsyncClientManager timeout race
Patch: Vadim Spivak
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/194f0114
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/194f0114
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/194f0114
Branch: refs/heads/master
Commit: 194f0114c27f6a41c96be6d5702895bf5c1519e3
Parents: 9aa08a9
Author: Roger Meier <ro...@apache.org>
Authored: Wed Jan 22 00:10:31 2014 +0100
Committer: Roger Meier <ro...@apache.org>
Committed: Wed Jan 22 00:10:31 2014 +0100
----------------------------------------------------------------------
lib/java/src/org/apache/thrift/async/TAsyncMethodCall.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/194f0114/lib/java/src/org/apache/thrift/async/TAsyncMethodCall.java
----------------------------------------------------------------------
diff --git a/lib/java/src/org/apache/thrift/async/TAsyncMethodCall.java b/lib/java/src/org/apache/thrift/async/TAsyncMethodCall.java
index fcd50ea..5c679b6 100644
--- a/lib/java/src/org/apache/thrift/async/TAsyncMethodCall.java
+++ b/lib/java/src/org/apache/thrift/async/TAsyncMethodCall.java
@@ -65,7 +65,8 @@ public abstract class TAsyncMethodCall<T> {
private final AsyncMethodCallback<T> callback;
private final boolean isOneway;
private long sequenceId;
-
+ private final long timeout;
+
private ByteBuffer sizeBuffer;
private final byte[] sizeBufferArray = new byte[4];
private ByteBuffer frameBuffer;
@@ -79,6 +80,7 @@ public abstract class TAsyncMethodCall<T> {
this.client = client;
this.isOneway = isOneway;
this.sequenceId = TAsyncMethodCall.sequenceIdCounter.getAndIncrement();
+ this.timeout = client.getTimeout();
}
protected State getState() {
@@ -102,11 +104,11 @@ public abstract class TAsyncMethodCall<T> {
}
public boolean hasTimeout() {
- return client.hasTimeout();
+ return timeout > 0;
}
public long getTimeoutTimestamp() {
- return client.getTimeout() + startTime;
+ return timeout + startTime;
}
protected abstract void write_args(TProtocol protocol) throws TException;