/**
   * Register a pending Future that has a callback.
   *
   * @param future must have at least one callback
   */
  public static void addPending(Future<?> future) {
    Pending pend = pending.get();
    if (pend == null) {
      pend = new Pending();
      pending.set(pend);
    }

    pend.add(future);
  }
  /** Deregister a pending Future that had a callback. */
  public static void removePending(Future<?> future) {
    Pending pend = pending.get();
    if (pend != null) {
      pend.remove(future);

      // When the last one is gone, we don't need this thread local anymore
      if (pend.isEmpty()) pending.remove();
    }
  }
 /**
  * Iterate through all pending futures and get() them, forcing any callbacks to be called. This is
  * used only by the AsyncCacheFilter because we don't have a proper hook otherwise.
  */
 public static void completeAllPendingFutures() {
   Pending pend = pending.get();
   if (pend != null) pend.completeAllPendingFutures();
 }
Exemple #4
0
  protected void finalize() throws Throwable {
    super.finalize();

    if (attrs_ptr != null) hyperclient.delete_hyperclient_attribute_ptr(attrs_ptr);
    if (attrs_sz_ptr != null) hyperclient.delete_size_t_ptr(attrs_sz_ptr);
  }