public Promise<T> done(Effect<T> e) { return delegate.done(e); }
@Override public void apply(A v) { try { @SuppressWarnings("unchecked") Promise<B> next = (Promise<B>) f.apply(v); next.done(new Effect<B>() { @Override public void apply(B t) { result.set(t); } }).fail(failResult); } catch (Throwable t) { result.setException(t); } } }).fail(failResult);
@Override public Promise<A> done(Effect<? super A> e) { delegate().done(e); return this; }
@Override public <V> Promise<V> perform(final Function<StreamAttachmentStore, Promise<V>> operation) { return operation.get(primaryAttachmentStore).done( new Effect<V>() { @Override public void apply(final V v) { operation.get(secondaryAttachmentStore); } } ); } }
@Override public Promise<Unit> moveTemporaryToAttachment(final TemporaryAttachmentId temporaryAttachmentId, final AttachmentKey destinationKey) { return primaryStore.moveTemporaryToAttachment(temporaryAttachmentId, destinationKey) .done(sendAttachmentToSecondaryStore(destinationKey)); }
.done(new Effect<List<SynchronisationActivity>>() { @Override public void apply(final List<SynchronisationActivity> subsequentActivities) {
@Override public void notifyRoom(@Nonnull String toID, @Nonnull String msg, @Nonnull HipChatNotificationOptions options) throws ResponseException { if (isEnabled()) { Promise<Result<Void>> message = client.message(toID, applicationProperties.getDisplayName(), msg, Option.<Message.Format>none(), getBackgroundColorOf(options.getBackgroundColor()), Option.some(options.isNotifyingClients())); // We check the notification status message.done(new Effect<Result<Void>>() { @Override public void apply(Result<Void> response) { if (response.isError()) { log.warn(" Error communicating to Hipchat [{}]", response.error()); } } }); } }
.done(new Effect<A>()
@Override public Void call() throws Exception { if (!isCancelled()) { try { final Option<HipChatLink> defaultLinkOption = hipChatLinkProvider.getDefaultLink(); if (defaultLinkOption.isEmpty()) { logger.debug("The link has been deleted since the time the upgrader was scheduled."); } else { final HipChatLink hipChatLink = defaultLinkOption.get(); HipChatAPI<HipChatAPI.TokenType.AddonToken> hipChatAPI = hipChatLink.getAddonApi(); hipChatDescriptorUpdateService.updateConnectDescriptor(hipChatAPI, newConnectDescriptor) .done(new Effect<Result<Void>>() { @Override public void apply(final Result<Void> result) { handleDone(result, hipChatLink); } }) .fail(failureHandler); } } catch (final Exception e) { handleInternalError(e); } } return null; }
.done(new Effect<List<ConnectDescriptor>>() { @Override public void apply(final List<ConnectDescriptor> connectDescriptors) {
.done(new Effect<Result<GenerateTokenResult>>() { @Override public void apply(Result<GenerateTokenResult> result) {