All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avaje.ebeaninternal.server.query.BaseFuture Maven / Gradle / Ivy

package com.avaje.ebeaninternal.server.query;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

/**
 * A base object for query Future objects.
 *
 * @param  the entity bean type
 * @author rbygrave
 */
public abstract class BaseFuture implements Future {

  protected final FutureTask futureTask;

  public BaseFuture(FutureTask futureTask) {
    this.futureTask = futureTask;
  }

  public boolean cancel(boolean mayInterruptIfRunning) {
    return futureTask.cancel(mayInterruptIfRunning);
  }

  public T get() throws InterruptedException, ExecutionException {
    return futureTask.get();
  }

  public T get(long timeout, TimeUnit unit)
      throws InterruptedException, ExecutionException, TimeoutException {

    return futureTask.get(timeout, unit);
  }

  public boolean isCancelled() {
    return futureTask.isCancelled();
  }

  public boolean isDone() {
    return futureTask.isDone();
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy