Esempio n. 1
0
 @Override
 public void run() {
   try {
     freenet.support.Logger.OSThread.logPID(this);
     // FIXME ? key is not known for inserts here
     if (key != null) stats.reportOutgoingLocalRequestLocation(key.toNormalizedDouble());
     if (!req.send(core, sched)) {
       if (!((!req.isPersistent()) && req.isCancelled()))
         Logger.error(this, "run() not able to send a request on " + req);
       else
         Logger.normal(
             this, "run() not able to send a request on " + req + " - request was cancelled");
     }
     if (logMINOR) Logger.minor(this, "Finished " + req);
   } finally {
     if (req.sendIsBlocking()) {
       if (key != null) sched.removeFetchingKey(key);
       else if ((!req.isPersistent())
           && ((TransientChosenBlock) req).request instanceof SendableInsert)
         sched.removeTransientInsertFetching(
             (SendableInsert) (((TransientChosenBlock) req).request), req.token);
       // Something might be waiting for a request to complete (e.g. if we have two requests for
       // the same key),
       // so wake the starter thread.
       wakeUp();
     }
   }
 }