@@ -50,15 +50,15 @@ public class DefaultFuture extends CompletableFuture<Object> {
5050
5151 private static final Map <Long , DefaultFuture > FUTURES = new ConcurrentHashMap <>();
5252
53- private static final Map <Long , Timeout > PENDING_TASKS = new ConcurrentHashMap <>();
53+ // private static final Map<Long, Timeout> PENDING_TASKS = new ConcurrentHashMap<>();
5454
5555 public static final Timer TIME_OUT_TIMER = new HashedWheelTimer (
5656 new NamedThreadFactory ("dubbo-future-timeout" , true ),
5757 30 ,
5858 TimeUnit .MILLISECONDS );
5959
6060 // invoke id.
61- private final long id ;
61+ private final Long id ;
6262 private final Channel channel ;
6363 private final Request request ;
6464 private final int timeout ;
@@ -146,11 +146,11 @@ public static void received(Channel channel, Response response) {
146146 DefaultFuture future = FUTURES .remove (response .getId ());
147147 if (future != null ) {
148148 future .doReceived (response );
149- Timeout t = PENDING_TASKS .remove (future .getId ());
150- if (t != null ) {
151- // decrease Time
152- t .cancel ();
153- }
149+ // Timeout t = PENDING_TASKS.remove(future.getId());
150+ // if (t != null) {
151+ // // decrease Time
152+ // t.cancel();
153+ // }
154154 } else {
155155 logger .warn ("The timeout response finally returned at "
156156 + (new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss.SSS" ).format (new Date ()))
@@ -228,10 +228,11 @@ private void doSent() {
228228 * check time out of the future
229229 */
230230 private static void timeoutCheck (DefaultFuture future ) {
231- TimeoutCheckTask task = new TimeoutCheckTask (future );
232- Timeout t = TIME_OUT_TIMER .newTimeout (task , future .getTimeout (), TimeUnit .MILLISECONDS );
233- PENDING_TASKS .put (future .getId (), t );
231+ TimeoutCheckTask task = new TimeoutCheckTask (future . getId () );
232+ TIME_OUT_TIMER .newTimeout (task , future .getTimeout (), TimeUnit .MILLISECONDS );
233+ // PENDING_TASKS.put(future.getId(), t);
234234 }
235+
235236 private String getTimeoutMessage (boolean scan ) {
236237 long nowTimestamp = System .currentTimeMillis ();
237238 return (sent > 0 ? "Waiting server-side response timeout" : "Sending request timeout in client-side" )
@@ -247,18 +248,19 @@ private String getTimeoutMessage(boolean scan) {
247248
248249 private static class TimeoutCheckTask implements TimerTask {
249250
250- private DefaultFuture future ;
251+ private final Long requestID ;
251252
252- TimeoutCheckTask (DefaultFuture future ) {
253- this .future = future ;
253+ TimeoutCheckTask (Long requestID ) {
254+ this .requestID = requestID ;
254255 }
255256
256257 @ Override
257258 public void run (Timeout timeout ) {
258259 // remove from pending task
259- PENDING_TASKS .remove (future .getId ());
260+ // PENDING_TASKS.remove(future.getId());
260261
261- if (future .isDone ()) {
262+ DefaultFuture future = FUTURES .remove (requestID );
263+ if (future == null || future .isDone ()) {
262264 return ;
263265 }
264266 if (future .getExecutor () != null ) {
0 commit comments