public synchronized void add ( RemoteAsyncResultImpl asyncResult ) { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; ivAllRemoteAsyncResults . add ( asyncResult ) ; if ( asyncResult . ivPmiBean != null ) { // d690014.3 asyncResult . ivPmiBean . asyncFutureObjectIncrement ( ) ; } int size = ivAllRemoteAsyncResults . size ( ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "add " + asyncResult + "; size=" + size ) ; // If this is the only entry in the list, setup the alarm. d623593 if ( size == 1 ) { ivFuture = ivScheduledExecutor . schedule ( this , ivAlarmIntervalMillis , TimeUnit . MILLISECONDS ) ; } else if ( size >= ivNearMaxResultsThreshold ) { // d690014.1 - Remove the oldest entry if we have exceeded the maximum // number of results. Otherwise, issue a warning since we are near // the maximum. boolean warn = false ; if ( size > ivMaxUnclaimedResults ) { if ( ! ivWarnedExceededMax ) { warn = ivWarnedExceededMax = true ; } Iterator < RemoteAsyncResultImpl > iterator = ivAllRemoteAsyncResults . iterator ( ) ; RemoteAsyncResultImpl oldest = iterator . next ( ) ; releaseResources ( oldest ) ; // d690014.3 iterator . remove ( ) ; } else { if ( ! ivWarnedNearMax ) { warn = ivWarnedNearMax = true ; } } if ( warn ) { Tr . warning ( tc , "MAXIMUM_UNCLAIMED_ASYNC_RESULTS_CNTR0328W" , size , ivMaxUnclaimedResults ) ; } } }
Add a new server - side Future object to the list to be checked for timeouts