Ejemplo n.º 1
0
 /** Cancels all companions for a given file. */
 private synchronized void cancelCompanions(PnfsId pnfsId, String cause) {
   for (Companion companion : _companions.values()) {
     if (pnfsId.equals(companion.getPnfsId())) {
       companion.cancel(cause);
     }
   }
 }
Ejemplo n.º 2
0
 public synchronized void messageArrived(DoorTransferFinishedMessage message) {
   HttpProtocolInfo pinfo = (HttpProtocolInfo) message.getProtocolInfo();
   int sessionId = pinfo.getSessionId();
   Companion companion = _companions.get(sessionId);
   if (companion != null) {
     companion.messageArrived(message);
   }
 }
Ejemplo n.º 3
0
 /** Cancels all transfers. */
 public synchronized void shutdown() throws InterruptedException {
   for (Companion companion : _companions.values()) {
     companion.cancel("Pool is going down");
   }
   while (!_companions.isEmpty()) {
     wait();
   }
 }
Ejemplo n.º 4
0
  public synchronized void messageArrived(HttpDoorUrlInfoMessage message) {
    int sessionId = (int) message.getId();
    Companion companion = _companions.get(sessionId);
    if (companion != null) {
      companion.messageArrived(message);
    } else {
      /* The original p2p is no longer around, but maybe we can use the redirect
       * for another p2p transfer.
       */
      PnfsId pnfsId = new PnfsId(message.getPnfsId());
      for (Companion c : _companions.values()) {
        if (c.getPnfsId().equals(pnfsId)) {
          c.messageArrived(message);
          return;
        }
      }

      /* TODO: We should kill the mover, but at the moment we don't
       * know the mover id here.
       */
    }
  }
Ejemplo n.º 5
0
 /**
  * Cancels a transfer. Returns true if the transfer was cancelled. Returns false if the transfer
  * was already completed or did not exist.
  */
 public synchronized boolean cancel(int id) {
   Companion companion = _companions.get(id);
   return (companion != null) && companion.cancel("Transfer was cancelled");
 }
Ejemplo n.º 6
0
 /** Adds a companion to the _companions map. */
 private synchronized int addCompanion(Companion companion) {
   int sessionId = companion.getId();
   _companions.put(sessionId, companion);
   return sessionId;
 }