public List < ResourceGrant > releaseResource ( List < Integer > idList ) { if ( deleted ) { throw new RuntimeException ( "Session: " + sessionId + " has been deleted" ) ; } List < ResourceGrant > canceledGrants = new ArrayList < ResourceGrant > ( ) ; for ( Integer id : idList ) { ResourceRequestInfo req = idToRequest . get ( id ) ; if ( req != null ) { idToRequest . remove ( id ) ; ResourceGrant grant = idToGrant . remove ( id ) ; if ( grant != null ) { // we have previously granted this resource, return to caller canceledGrants . add ( grant ) ; removeGrantedRequest ( req , false ) ; } else { removePendingRequest ( req ) ; } incrementRequestCount ( req . getType ( ) , - 1 ) ; } } return canceledGrants ; }
Release the resources that are no longer needed from the session