net.spy.memcached.internal.GetFuture Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spymemcached Show documentation
Show all versions of spymemcached Show documentation
A simple, asynchronous, single-threaded Memcached client written in java.
The newest version!
package net.spy.memcached.internal;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import net.spy.memcached.ops.Operation;
/**
* Future returned for GET operations.
*
* Not intended for general use.
*
* @param Type of object returned from the get
*/
public class GetFuture implements Future {
private final OperationFuture> rv;
public GetFuture(CountDownLatch l, long opTimeout) {
this.rv = new OperationFuture>(l, opTimeout);
}
public boolean cancel(boolean ign) {
return rv.cancel(ign);
}
public T get() throws InterruptedException, ExecutionException {
Future v = rv.get();
return v == null ? null : v.get();
}
public T get(long duration, TimeUnit units)
throws InterruptedException, TimeoutException, ExecutionException {
Future v = rv.get(duration, units);
return v == null ? null : v.get();
}
public void set(Future d) {
rv.set(d);
}
public void setOperation(Operation to) {
rv.setOperation(to);
}
public boolean isCancelled() {
return rv.isCancelled();
}
public boolean isDone() {
return rv.isDone();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy