Example usage for com.google.common.util.concurrent Futures immediateFuture

List of usage examples for com.google.common.util.concurrent Futures immediateFuture

Introduction

In this page you can find the example usage for com.google.common.util.concurrent Futures immediateFuture.

Prototype

@CheckReturnValue
public static <V> ListenableFuture<V> immediateFuture(@Nullable V value) 

Source Link

Document

Creates a ListenableFuture which has its value set immediately upon construction.

Usage

From source file:org.inocybe.bepbop.ParrotRpcService.java

@Override
public Future<RpcResult<Void>> takeOff() {

    LOG.info("Taking off");

    drone.takeoff();/*from   w ww. ja  v  a2s.  co m*/

    return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
}

From source file:ntfbenchmark.impl.NtfbenchTestListener.java

public Future<?> getAllDone() {
    return Futures.immediateFuture(null);
}

From source file:org.esbtools.eventhandler.testing.StringDocumentEvent.java

@Override
public Future<?> lookupDocument() {
    return Futures.immediateFuture(value);
}

From source file:com.skcraft.plume.common.util.concurrent.DeferredImpl.java

@Override
public <O> Deferred<O> thenRun(final Callable<O> task, ListeningExecutorService executor) {
    return new DeferredImpl<>(Futures.transform(future,
            (AsyncFunction<I, O>) input -> Futures.immediateFuture(task.call()), executor), defaultExecutor);
}

From source file:com.facebook.buck.artifact_cache.NoopArtifactCache.java

@Override
public ListenableFuture<Void> store(ArtifactInfo info, BorrowablePath output) {
    return Futures.immediateFuture(null);
}

From source file:test.DependentProducerModule.java

@Produces
ListenableFuture<List<String>> greetings(Integer numGreetings, String greeting) {
    List<String> greetings = ImmutableList.of(String.valueOf(numGreetings), greeting,
            Ascii.toUpperCase(greeting));
    return Futures.immediateFuture(greetings);
}

From source file:org.immutables.eventual.SampleEventuality.java

@Exposed
@Eventually.Provides
ListenableFuture<Boolean> getInput(@Named("input") String input) {
    tracker.add(1);
    return Futures.immediateFuture(Boolean.parseBoolean(input));
}

From source file:com.facebook.swift.service.async.DelayedMapAsyncHandler.java

@Override
public ListenableFuture<Void> putValueSlowly(long timeout, TimeUnit unit, String key, String value)
        throws TException {
    innerHandler.putValueSlowly(timeout, unit, key, value);
    return Futures.immediateFuture((Void) null);
}

From source file:com.facebook.buck.util.network.FakeFailingScribeLogger.java

@Override
public ListenableFuture<Void> log(String category, Iterable<String> lines) {
    return failLogging.compareAndSet(false, true) ? Futures.immediateFuture(null)
            : Futures.immediateFailedFuture(new IOException());
}

From source file:io.soliton.protobuf.DnsServer.java

@Override
public ListenableFuture<DnsResponse> resolve(TestingSingleFile.DnsRequest request) {
    DnsResponse response = DnsResponse.newBuilder().setIpAddress(1234567).build();
    return Futures.immediateFuture(response);
}