@Override public Future<Set<SourceIdentifier>> getProvidedSources() { return akka.dispatch.Futures.successful(providedSources); }
@Override public Future<Set<SourceIdentifier>> getProvidedSources() { return akka.dispatch.Futures.successful(providedSources); }
@Override @Nonnull public Future<Boolean> isEmpty() { return Futures.successful(nrTokens < ONE_TOKEN); }
public void putSuccessful(@Nonnull String shardName, @Nonnull PrimaryShardInfo info) { primaryShardInfoCache.put(shardName, Futures.successful(info)); }
@Override public Future<Optional<SelectedSnapshot>> doLoadAsync(final String persistenceId, final SnapshotSelectionCriteria criteria) { LOG.debug("In doLoadAsync - persistenceId: {}, criteria: {}", persistenceId, criteria); // Select the youngest 'maxLoadAttempts' snapshots that match the criteria. This may help in situations where // saving of a snapshot could not be completed because of a JVM crash. Hence, an attempt to load that snapshot // will fail but loading an older snapshot may succeed. Deque<SnapshotMetadata> metadatas = getSnapshotMetadatas(persistenceId, criteria).stream() .sorted(LocalSnapshotStore::compare).collect(reverse()).stream().limit(maxLoadAttempts) .collect(Collectors.toCollection(ArrayDeque::new)); if (metadatas.isEmpty()) { return Futures.successful(Optional.empty()); } LOG.debug("doLoadAsync - found: {}", metadatas); return Futures.future(() -> doLoad(metadatas), executionContext); }
public Future<ActorRef> getActorRefFuture(K key) { final int partitionNumber = retrievalService.getPartitionID(key); synchronized (cacheLock) { ActorRef result = cache.get(partitionNumber); if(result != null) { return Futures.successful(result); } } LOG.debug("Retrieve actor URL from retrieval service."); String actorURL = retrievalService.retrieveActorURL(key); if (actorURL == null) { return Futures.failed(new Exception("Could not retrieve actor.")); } else { ActorSelection selection = getContext().system().actorSelection(actorURL); LOG.debug("Resolve actor URL to ActorRef."); Future<ActorRef> actorRefFuture = selection.resolveOne(lookupTimeout); actorRefFuture.onSuccess(new OnSuccess<ActorRef>() { @Override public void onSuccess(ActorRef result) throws Throwable { synchronized (cacheLock) { cache.put(partitionNumber, result); } } }, executor); return actorRefFuture; } }
public Future<play.api.mvc.Result> onHandlerNotFound(play.api.mvc.RequestHeader request) { ErrorResponse er = apply(NOT_FOUND, "URI not found", apply$default$3(), Some.apply(request.path())); return Futures.successful(notFound(toJson(er)).toScala()); }
@Test public void getExistingYangTextSchemaSource() throws IOException, SchemaSourceException { String source = "Test"; YangTextSchemaSource schemaSource = YangTextSchemaSource.delegateForByteSource( ID, ByteSource.wrap(source.getBytes())); YangTextSchemaSourceSerializationProxy sourceProxy = new YangTextSchemaSourceSerializationProxy(schemaSource); Mockito.when(mockedRemoteSchemaRepository.getYangTextSchemaSource(ID)) .thenReturn(Futures.successful(sourceProxy)); YangTextSchemaSource providedSource = remoteSchemaProvider.getSource(ID).checkedGet(); assertEquals(providedSource.getIdentifier(), ID); assertArrayEquals(providedSource.read(), schemaSource.read()); }
sender.tell(Futures.successful(Boolean.TRUE), self()); target.tell(msg, self());