Ejemplo n.º 1
0
  public void tripPendingKey(final KeyBlock block) {
    if (logMINOR) Logger.minor(this, "tripPendingKey(" + block.getKey() + ")");

    if (offeredKeys != null) {
      offeredKeys.remove(block.getKey());
    }
    final Key key = block.getKey();
    if (schedTransient.anyProbablyWantKey(key, clientContext)) {
      this.clientContext.mainExecutor.execute(
          new PrioRunnable() {

            @Override
            public void run() {
              schedTransient.tripPendingKey(key, block, null, clientContext);
            }

            @Override
            public int getPriority() {
              return TRIP_PENDING_PRIORITY;
            }
          },
          "Trip pending key (transient)");
    }
    if (schedCore == null) return;
    if (schedCore.anyProbablyWantKey(key, clientContext)) {
      try {
        jobRunner.queue(
            new DBJob() {

              @Override
              public boolean run(ObjectContainer container, ClientContext context) {
                if (logMINOR) Logger.minor(this, "tripPendingKey for " + key);
                if (schedCore.tripPendingKey(key, block, container, clientContext))
                  context.jobRunner.setCommitSoon();
                return false;
              }

              @Override
              public String toString() {
                return "tripPendingKey";
              }
            },
            TRIP_PENDING_PRIORITY,
            false);
      } catch (DatabaseDisabledException e) {
        // Nothing to do
      }
    } else schedCore.countNegative();
  }
Ejemplo n.º 2
0
 /* FIXME SECURITY When/if introduce tunneling or similar mechanism for starting requests
  * at a distance this will need to be reconsidered. See the comments on the caller in
  * RequestHandler (onAbort() handler). */
 @Override
 public boolean wantKey(Key key) {
   if (schedTransient.anyProbablyWantKey(key, clientContext)) return true;
   if (schedCore != null && schedCore.anyProbablyWantKey(key, clientContext)) return true;
   return false;
 }