public void run()

in src/main/java/com/alibaba/cloudapi/sdk/util/CallbackManager.java [64:93]


    public void run() {
        Long current;
        while(true){
            current = (new Date()).getTime();
            ArrayList<Integer> toBeRemove = new ArrayList<Integer>();
            for (Map.Entry<Integer , ApiContext> callback : callbacks.entrySet()){
                ApiContext context = callback.getValue();
                if((current -  context.getStartTime()) > requestExpiredTime){
                    context.getCallback().onFailure(context.getRequest() , new SdkException("Get Response Timeout"));
                    toBeRemove.add(callback.getKey());
                }
            }

            for(Integer key : toBeRemove){
                callbacks.remove(key);
            }

            try {
                if(callbacks.size() == 0) {
                    countDownLatch = new CountDownLatch(1);
                    countDownLatch.await();
                }

                Thread.sleep(CHECK_EXPIRE_INTERVAL);
            }
            catch (Exception ex){
                LOG.error("Check callback expired" , ex);
            }
        }
    }