List of usage examples for com.google.common.util.concurrent Futures immediateFuture
@CheckReturnValue public static <V> ListenableFuture<V> immediateFuture(@Nullable V value)
From source file:org.jclouds.blobstore.util.BlobStoreUtils.java
public static ListenableFuture<Void> createParentIfNeededAsync(AsyncBlobStore asyncBlobStore, String container, Blob blob) {//w ww. j a va2 s. com checkNotNull(asyncBlobStore, "asyncBlobStore"); checkNotNull(container, "container"); String name = blobName.apply(blob); if (name.indexOf('/') > 0) { return asyncBlobStore.createDirectory(container, parseDirectoryFromPath(name)); } else { return Futures.immediateFuture(null); } }
From source file:org.apache.qpid.server.security.AllowAllAccessControlProviderImpl.java
@StateTransition(currentState = { State.UNINITIALIZED, State.QUIESCED, State.ERRORED }, desiredState = State.ACTIVE) @SuppressWarnings("unused") private ListenableFuture<Void> activate() { setState(_broker.isManagementMode() ? State.QUIESCED : State.ACTIVE); return Futures.immediateFuture(null); }
From source file:org.eclipse.neoscada.protocol.iec60870.server.data.AbstractBaseDataModel.java
protected synchronized ListenableFuture<Void> disposeSubscription(final DefaultSubscription subscription) { this.subscriptions.remove(subscription); this.numberOfSubscriptions = this.subscriptions.size(); if (this.executor.isShutdown()) { // if we are already disposed return Futures.immediateFuture(null); }/*from w w w . ja v a 2s.c om*/ // the completion will come from the executor, so the completion has to wait in line // with possible remaining updated return this.executor.submit(() -> null); }
From source file:com.facebook.presto.operator.index.IndexLookupSourceSupplier.java
@Override public ListenableFuture<LookupSource> getLookupSource(OperatorContext operatorContext) { IndexLoader indexLoader = indexLoaderSupplier.get(); indexLoader.setContext(operatorContext.getDriverContext().getPipelineContext().getTaskContext()); return Futures.immediateFuture(new IndexLookupSource(indexLoader)); }
From source file:org.mule.module.extension.internal.runtime.ReflectiveMethodOperationExecutor.java
/** * {@inheritDoc}/*w w w . j a va 2s. c o m*/ */ @Override public Future<Object> execute(OperationContext operationContext) throws Exception { Object result = invokeMethod(operationMethod, executorDelegate, getParameterValues(operationContext)); return Futures.immediateFuture(returnDelegate.asReturnValue(result, operationContext)); }
From source file:io.v.impl.google.rpc.ClientCallImpl.java
@Override public ListenableFuture<Object[]> finish(final Type[] types) { ListenableFutureCallback<byte[][]> callback = new ListenableFutureCallback<>(); nativeFinish(nativeRef, types.length, callback); return VFutures.withUserLandChecks(ctx, Futures.transform(callback.getVanillaFuture(), new AsyncFunction<byte[][], Object[]>() { @Override//ww w . jav a 2 s . c o m public ListenableFuture<Object[]> apply(byte[][] vomResults) throws Exception { if (vomResults.length != types.length) { throw new VException(String.format("Mismatch in number of results, want %s, have %s", types.length, vomResults.length)); } // VOM-decode results. Object[] ret = new Object[types.length]; for (int i = 0; i < types.length; i++) { ret[i] = VomUtil.decode(vomResults[i], types[i]); } return Futures.immediateFuture(ret); } })); }
From source file:com.google.api.server.spi.config.datastore.testing.FakeAsyncMemcacheService.java
@Override public Future<Boolean> delete(Object key, long millisNoReAdd) { return Futures.immediateFuture(memcacheService.delete(key, millisNoReAdd)); }
From source file:org.thingsboard.server.service.script.AbstractJsInvokeService.java
@Override public ListenableFuture<Void> release(UUID scriptId) { String functionName = scriptIdToNameMap.get(scriptId); if (functionName != null) { try {/* www. ja v a 2 s . co m*/ scriptIdToNameMap.remove(scriptId); blackListedFunctions.remove(scriptId); doRelease(scriptId, functionName); } catch (Exception e) { return Futures.immediateFailedFuture(e); } } return Futures.immediateFuture(null); }
From source file:org.thingsboard.server.dao.sql.attributes.JpaAttributeDao.java
@Override public ListenableFuture<List<AttributeKvEntry>> find(TenantId tenantId, EntityId entityId, String attributeType, Collection<String> attributeKeys) { List<AttributeKvCompositeKey> compositeKeys = attributeKeys.stream() .map(attributeKey -> getAttributeKvCompositeKey(entityId, attributeType, attributeKey)) .collect(Collectors.toList()); return Futures.immediateFuture( DaoUtil.convertDataList(Lists.newArrayList(attributeKvRepository.findAll(compositeKeys)))); }
From source file:org.apache.qpid.server.security.auth.manager.ManagedUser.java
@StateTransition(currentState = { State.ACTIVE }, desiredState = State.DELETED) private ListenableFuture<Void> doDelete() { _authenticationManager.getUserMap().remove(getName()); deleted();// www .j a va 2 s . com return Futures.immediateFuture(null); }