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:com.proofpoint.discovery.client.announce.NullAnnouncer.java

@Override
public ListenableFuture<?> forceAnnounce() {
    return Futures.immediateFuture(null);
}

From source file:com.yahoo.yqlplus.engine.sources.AsyncSource.java

@Query
public ListenableFuture<Person> lookup(@Key("id") String id) {
    if ("1".equals(id)) {
        return Futures.immediateFuture(new Person("1", "joe", 1));
    } else if ("3".equals(id)) {
        return Futures.immediateFuture(new Person("3", "smith", 1));
    } else {/* www  . jav  a 2  s .  c o  m*/
        return Futures.immediateFuture(null);
    }
}

From source file:co.cask.cdap.common.conf.InMemoryPropertyStore.java

@Override
public synchronized ListenableFuture<T> update(String name, PropertyUpdater<T> updater) {
    try {/* w w w.  jav  a 2  s.c  o m*/
        T property = updater.apply(getCached(name)).get();
        updateAndNotify(name, property);
        return Futures.immediateFuture(property);
    } catch (Exception e) {
        return Futures.immediateFailedFuture(e);
    }
}

From source file:co.cask.cdap.data.stream.service.heartbeat.NoOpHeartbeatPublisher.java

@Override
public ListenableFuture<StreamWriterHeartbeat> sendHeartbeat(StreamWriterHeartbeat heartbeat) {
    return Futures.immediateFuture(heartbeat);
}

From source file:com.osbolab.commons.MoreEithers.java

public static <L, T> ListenableFuture<Either<L, Option<T>>> someFutureRight(T of) {
    return Futures.immediateFuture(MoreEithers.<L, T>someRight(of));
}

From source file:crud.http.ListenerInvokingAnswer.java

public ListenerInvokingAnswer(final ClientResponse response) {
    this(Futures.immediateFuture(response));
}

From source file:org.glowroot.agent.embedded.repo.AgentDisplayRepositoryImpl.java

@Override
public ListenableFuture<String> readLastDisplayPartAsync(String agentRollupId) {
    return Futures.immediateFuture("");
}

From source file:com.github.avarabyeu.wills.Wills.java

/**
 * Creates successful {@link Will} from provided object
 *
 * @param value Object {@link Will} be created from
 * @param <A>   Type of Will// www  . j  a  v  a  2s . c om
 * @return Will
 */
public static <A> Will<A> of(A value) {
    return new Of<A>(Futures.immediateFuture(value));
}

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

@Override
public Future<Collection<DocumentEvent>> toDocumentEvents() {
    return Futures.immediateFuture(Arrays.asList(new StringDocumentEvent(value)));
}

From source file:com.google.idea.blaze.base.prefetch.MockPrefetchService.java

@Override
public ListenableFuture<?> prefetchProjectFiles(Project project, BlazeProjectData blazeProjectData) {
    return Futures.immediateFuture(null);
}