コード例 #1
0
ファイル: P2PClient.java プロジェクト: jstarek/dcache
 /** 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);
     }
   }
 }
コード例 #2
0
ファイル: P2PClient.java プロジェクト: jstarek/dcache
 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);
   }
 }
コード例 #3
0
ファイル: P2PClient.java プロジェクト: jstarek/dcache
 /** Cancels all transfers. */
 public synchronized void shutdown() throws InterruptedException {
   for (Companion companion : _companions.values()) {
     companion.cancel("Pool is going down");
   }
   while (!_companions.isEmpty()) {
     wait();
   }
 }
コード例 #4
0
ファイル: P2PClient.java プロジェクト: jstarek/dcache
  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.
       */
    }
  }
コード例 #5
0
ファイル: P2PClient.java プロジェクト: jstarek/dcache
 /**
  * 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");
 }
コード例 #6
0
ファイル: P2PClient.java プロジェクト: jstarek/dcache
 /** Adds a companion to the _companions map. */
 private synchronized int addCompanion(Companion companion) {
   int sessionId = companion.getId();
   _companions.put(sessionId, companion);
   return sessionId;
 }