scanry opened a new issue #1525: About clean “DefaultFuture” of overtime issue
URL: https://github.com/apache/incubator-dubbo/issues/1525
 
 
   Current way:
   private static class RemotingInvocationTimeoutScan implements Runnable {
   
           public void run() {
               while (true) {
                   try {
                       for (DefaultFuture future : FUTURES.values()) {
                           if (future == null || future.isDone()) {
                               continue;
                           }
                           if (System.currentTimeMillis() - 
future.getStartTimestamp() > future.getTimeout()) {
                               // create exception response.
                               Response timeoutResponse = new 
Response(future.getId());
                               // set timeout status.
                               timeoutResponse.setStatus(future.isSent() ? 
Response.SERVER_TIMEOUT : 
                               Response.CLIENT_TIMEOUT);
                               
timeoutResponse.setErrorMessage(future.getTimeoutMessage(true));
                               // handle response.
                               DefaultFuture.received(future.getChannel(), 
timeoutResponse);
                           }
                       }
                       Thread.sleep(30);
                   } catch (Throwable e) {
                       logger.error("Exception when scan the timeout invocation 
of remoting.", e);
                   }
               }
           }
       }
   problems:
   1.30 milliseconds per interval scan caching,failure to achieve effective 
cleaning quality。
   2.Full scan caching will improve lock competition。
   
   so(simple code examples):
      if (rpcRequest.isAsy()) {
         scheduledExecutorService.schedule(()->{
            removeFuture(requestId);
         },rpcRequest.getCallTimeout()+N, TimeUnit.MILLISECONDS);
     }
   
   Is this more reasonable? -  -!
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to