void timeout ( ) { long time = System . currentTimeMillis ( ) ; Iterator < Map . Entry < Long , ContextualFuture > > iterator = responseFutures . entrySet ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { ContextualFuture future = iterator . next ( ) . getValue ( ) ; if ( future . time + requestTimeout < time ) { iterator . remove ( ) ; future . context . executor ( ) . execute ( ( ) -> future . completeExceptionally ( new TimeoutException ( "request timed out" ) ) ) ; } else { break ; } } }
Times out requests .