@ SuppressWarnings ( "WeakerAccess" ) public final boolean supply ( Timeout timeout , Consumer < T > consumer ) throws InterruptedException { T obj = claim ( timeout ) ; if ( obj == null ) { return false ; } try { consumer . accept ( obj ) ; return true ; } finally { obj . release ( ) ; } }
Claim an object from the pool and supply it to the given consumer and then release it back to the pool .