Example #1
0
  @Override
  public synchronized void afterStart() {
    CellStub.addCallback(
        poolManagerStub.send(
            new PoolManagerGetPoolMonitor(), CellEndpoint.SendFlag.RETRY_ON_NO_ROUTE_TO_CELL),
        new AbstractMessageCallback<PoolManagerGetPoolMonitor>() {
          @Override
          public void success(PoolManagerGetPoolMonitor message) {
            messageArrived(message.getPoolMonitor());
          }

          @Override
          public void timeout(String message) {
            afterStart();
          }

          @Override
          public void failure(int rc, Object error) {}
        },
        MoreExecutors.directExecutor());
  }
 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");
   }
 }