Package freenet.node

Examples of freenet.node.BaseSendableGet


        /** Choose a recently succeeded request.
         * 50% chance of using a recently succeeded request, if there is one.
         * We keep a list of recently succeeded BaseSendableGet's, because transient
         * requests are chosen individually. */
        if(!isInsertScheduler) {
          BaseSendableGet altReq = null;
          synchronized(recentSuccesses) {
            if(!recentSuccesses.isEmpty()) {
              if(random.nextBoolean()) {
                altReq = recentSuccesses.poll();
              }
            }
          }
          if(altReq != null && (altReq.isCancelled())) {
            if(logMINOR)
              Logger.minor(this, "Ignoring cancelled recently succeeded item "+altReq);
            altReq = null;
          }
          if(altReq != null && (l = altReq.getWakeupTime(context, now)) != 0) {
            if(logMINOR) {
              Logger.minor(this, "Ignoring recently succeeded item, cooldown time = "+l+((l > 0) ? " ("+TimeUtil.formatTime(l - now)+")" : ""));
              altReq = null;
            }
          }
          if (altReq != null && altReq != req) {
            int prio = altReq.getPriorityClass();
            if(prio <= choosenPriorityClass) {
              // Use the recent one instead
              if(logMINOR)
                Logger.minor(this, "Recently succeeded (transient) req "+altReq+" (prio="+altReq.getPriorityClass()+") is better than "+req+" (prio="+req.getPriorityClass()+"), using that");
              // Don't need to reregister, because removeRandom doesn't actually remove!
              req = altReq;
            } else {
              // Don't use the recent one
              if(logMINOR)
View Full Code Here


        transientWaiting = this.transientRequestsWaitingForKeysFetching.remove(key);
      }
      if(transientWaiting != null) {
        if(transientWaiting != null) {
          for(WeakReference<BaseSendableGet> ref : transientWaiting) {
            BaseSendableGet get = ref.get();
            if(get == null) continue;
            get.clearWakeupTime(sched.getContext());
          }
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of freenet.node.BaseSendableGet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.