private void satisfyFuturesFromBuffer ( ) { synchronized ( futures ) { synchronized ( finishedTasks ) { // attempt to satisfy futures until we run out of either futures or // finished tasks while ( ( ! futures . isEmpty ( ) ) && ( ! finishedTasks . isEmpty ( ) ) ) { // Remove any expired tasks before attempting to fufill the future pruneExpiredTasks ( ) ; // Fufill the future from a non expired task if there is one. There is still a // slight chance that the first task could have expired between the time we // pruned and the time we fufill the future if ( ! finishedTasks . isEmpty ( ) ) { fufillFuture ( futures . poll ( ) ) ; } } } } }
Attempts to satisfy some or all of the already - issued futures from the local buffer . If the buffer is empty or there are no futures this method won t do anything .