Package freenet.support

Examples of freenet.support.RandomGrabArray


    return parentGrabArray;
  }
 
  /** Grab it to avoid race condition when unregistering twice in parallel. */
  private synchronized RandomGrabArray grabParentGrabArray() {
    RandomGrabArray ret = parentGrabArray;
    parentGrabArray = null;
    return ret;
  }
View Full Code Here


   * @param oldPrio If we are changing priorities it can matter what the old priority is.
   * However the parent method, SendableRequest, ignores this. In any case,
   * (short)-1 means not specified (look it up).
   */
  public void unregister(ClientContext context, short oldPrio) {
    RandomGrabArray arr = grabParentGrabArray();
    if(arr != null) {
      synchronized(getScheduler(context)) {
        arr.remove(this, context);
      }
    } else {
      // Should this be a higher priority?
      if(logMINOR)
        Logger.minor(this, "Cannot unregister "+this+" : not registered", new Exception("debug"));
View Full Code Here

    return super.toString();
  }
 
    @Override
    public boolean reduceWakeupTime(long wakeupTime, ClientContext context) {
        RandomGrabArray parent = getParentGrabArray();
        if(parent == null) return false;
        return parent.reduceWakeupTime(wakeupTime, context);
    }
View Full Code Here

        return parent.reduceWakeupTime(wakeupTime, context);
    }

    @Override
    public void clearWakeupTime(ClientContext context) {
        RandomGrabArray parent = getParentGrabArray();
        if(parent == null) return;
        parent.clearWakeupTime(context);
    }
View Full Code Here

          // maybe we should ask people to report that error if seen
          Logger.normal(this, "In wrong priority class: "+req+" (req.prio="+req.getPriorityClass()+" but chosen="+choosenPriorityClass+ ')');
          // Remove it.
          ClientRequestRGANode clientGrabber = chosenTracker.getGrabber(req.getClient());
          if(clientGrabber != null) {
            RandomGrabArray baseRGA = clientGrabber.getGrabber(req.getSchedulerGroup());
            if(baseRGA != null) {
              // Must synchronize to avoid nasty race conditions with cooldown.
              synchronized(this) {
                baseRGA.remove(req, context);
              }
            } else {
              // Okay, it's been removed already. Cool.
            }
          } else {
View Full Code Here

                        ClientRequestRGANode requestGrabber = prio.getGrabber(client);
                        System.out.println("SRGA for client: "+requestGrabber);
                        for(int l=0;l<requestGrabber.size();l++) {
                            ClientRequestSchedulerGroup cr = requestGrabber.getClient(l);
                            System.out.println("Request "+l+" : "+cr);
                            RandomGrabArray rga = requestGrabber.getGrabber(cr);
                            System.out.println("Queued SendableRequests: "+rga.size()+" on "+rga);
                            long sendable = 0;
                            long all = 0;
                            for(int m=0;m<rga.size();m++) {
                                SendableRequest req = (SendableRequest) rga.get(m);
                                if(req == null) continue;
                                sendable += req.countSendableKeys(context);
                                all += req.countAllKeys(context);
                            }
                            System.out.println("Sendable keys: "+sendable+" all keys "+all+" diff "+(all-sendable));
View Full Code Here

TOP

Related Classes of freenet.support.RandomGrabArray

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.