public static void releaseSpace( Subject subject, String spaceToken, Long spaceToReleaseInBytes, SrmReleaseSpaceCallback callback, CellStub spaceManagerStub, Executor executor) { LOGGER.trace( "SrmReleaseSpaceCompanion.releaseSpace({}, token {}, spaceToReleaseInBytes {})", subject.getPrincipals(), spaceToken, spaceToReleaseInBytes); try { long token = Long.parseLong(spaceToken); SrmReleaseSpaceCompanion companion = new SrmReleaseSpaceCompanion(callback); Release release = new Release(token, spaceToReleaseInBytes); release.setSubject(subject); CellStub.addCallback(spaceManagerStub.send(release), companion, executor); } catch (NumberFormatException e) { callback.invalidRequest("No such space"); } }
@Override public void success(Release releaseResponse) { callback.success( Long.toString(releaseResponse.getSpaceToken()), releaseResponse.getRemainingSizeInBytes()); }