Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,10 @@ public void scanResponseTable() {
while (it.hasNext()) {
Entry<Integer, ResponseFuture> next = it.next();
ResponseFuture rep = next.getValue();

if ((rep.getBeginTimestamp() + rep.getTimeoutMillis() + 1000) <= System.currentTimeMillis()) {
if (rep.isSyncInvoke()) {
continue;
}
if ((rep.getBeginTimestamp() + rep.getTimeoutMillis()) <= System.currentTimeMillis()) {
rep.release();
it.remove();
rfList.add(rep);
Expand Down Expand Up @@ -451,6 +453,7 @@ public void invokeAsyncImpl(final Channel channel, final RemotingCommand request
}

final ResponseFuture responseFuture = new ResponseFuture(channel, opaque, timeoutMillis - costTime, invokeCallback, once);
responseFuture.setSyncInvoke(false);
this.responseTable.put(opaque, responseFuture);
try {
channel.writeAndFlush(request).addListener(new ChannelFutureListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class ResponseFuture {
private volatile RemotingCommand responseCommand;
private volatile boolean sendRequestOK = true;
private volatile Throwable cause;
private volatile boolean syncInvoke = true;

public ResponseFuture(Channel channel, int opaque, long timeoutMillis, InvokeCallback invokeCallback,
SemaphoreReleaseOnlyOnce once) {
Expand Down Expand Up @@ -121,6 +122,14 @@ public Channel getProcessChannel() {
return processChannel;
}

public boolean isSyncInvoke() {
return syncInvoke;
}

public void setSyncInvoke(boolean syncInvoke) {
this.syncInvoke = syncInvoke;
}

@Override
public String toString() {
return "ResponseFuture [responseCommand=" + responseCommand
Expand Down