public List < ResourceRequest > getResourcesToRelease ( ) { List < ResourceRequest > release = new ArrayList < ResourceRequest > ( ) ; synchronized ( lockObject ) { for ( Integer requestId : setDifference ( requestedResources . keySet ( ) , requestMap . keySet ( ) ) ) { // We update the data structures right away. This assumes that the // caller will be able to release the resources. ResourceRequest req = requestedResources . remove ( requestId ) ; if ( req != null ) { release . add ( req ) ; LOG . info ( "Filing release for requestId: " + req . getId ( ) ) ; } } } return release ; }
Go through all the requested resources and find what needs to be released .