synchronized int reserveNextCorrelationId ( VersionedIoFuture future ) { Integer next = getNextCorrelationId ( ) ; // Not likely but possible to use all IDs and start back at beginning while // old request still in progress. while ( requests . containsKey ( next ) ) { next = getNextCorrelationId ( ) ; } requests . put ( next , future ) ; return next ; }
Reserves a correlation ID by taking the next value and ensuring it is stored in the Map .