use of net.spy.memcached.internal.BulkFuture in project druid by druid-io.
the class MockMemcachedClient method asyncGetBulk.
@Override
public <T> BulkFuture<Map<String, T>> asyncGetBulk(final Iterator<String> keys, final Transcoder<T> tc) {
return new BulkFuture<Map<String, T>>() {
@Override
public boolean isTimeout() {
return false;
}
@Override
public Map<String, T> getSome(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException {
return get();
}
@Override
public OperationStatus getStatus() {
return null;
}
@Override
public Future<Map<String, T>> addListener(BulkGetCompletionListener bulkGetCompletionListener) {
return null;
}
@Override
public Future<Map<String, T>> removeListener(BulkGetCompletionListener bulkGetCompletionListener) {
return null;
}
@Override
public boolean cancel(boolean b) {
return false;
}
@Override
public boolean isCancelled() {
return false;
}
@Override
public boolean isDone() {
return true;
}
@Override
public Map<String, T> get() throws InterruptedException, ExecutionException {
Map<String, T> retVal = Maps.newHashMap();
while (keys.hasNext()) {
String key = keys.next();
CachedData data = theMap.get(key);
retVal.put(key, data != null ? tc.decode(data) : null);
}
return retVal;
}
@Override
public Map<String, T> get(long l, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException {
return get();
}
};
}
Aggregations