Skip to content

Commit c6e619b

Browse files
authored
Fix issue #15698 Distinguish between timeout and task rejection in DefaultFuture (#15738)
1 parent 7883aab commit c6e619b

File tree

1 file changed

+13
-1
lines changed
  • dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support

1 file changed

+13
-1
lines changed

dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ public void run(Timeout timeout) {
328328
try {
329329
executor.execute(() -> notifyTimeout(future));
330330
} catch (RejectedExecutionException e) {
331-
notifyTimeout(future);
331+
notifyExecutionError(future, e);
332332
throw e;
333333
}
334334
} else {
@@ -345,5 +345,17 @@ private void notifyTimeout(DefaultFuture future) {
345345
// handle response.
346346
DefaultFuture.received(future.getChannel(), timeoutResponse, true);
347347
}
348+
349+
private void notifyExecutionError(DefaultFuture future, Throwable e) {
350+
// create exception response.
351+
Response errorResponse = new Response(future.getId());
352+
// set error status
353+
errorResponse.setStatus(Response.SERVER_THREADPOOL_EXHAUSTED_ERROR);
354+
// set detailed error message
355+
errorResponse.setErrorMessage("Executor rejected the task for handling timeout notification: "
356+
+ e.getClass().getSimpleName() + " - " + e.getMessage());
357+
// handle response.
358+
DefaultFuture.received(future.getChannel(), errorResponse, true);
359+
}
348360
}
349361
}

0 commit comments

Comments
 (0)