@Override public void onSuccess(final StoreAttachmentResult result) { cleanEffect.apply(result); }
@Override public void onFailure(final Throwable t) { cleanEffect.apply(t); } };
@Override public void onFailure(Throwable t) { failure.apply(t); } };
@Override public void onSuccess(A result) { success.apply(result); }
public void apply(A a) { try { result.set(fa.apply(a)); } catch (Throwable t) { error.apply(t); } } }).fail(error);
@Override public void apply(final Object ignore) { try { effect.apply(ignore); } finally { IOUtils.closeQuietly(fileInputStream); } } });
private ResponsePromise doExecute(final Request request) httpClientOptions.getRequestPreparer().apply(request);
private ResponsePromise doExecute(final DefaultRequest request) httpClientOptions.getRequestPreparer().apply(request);
@Override public Unit get(final AttachmentGetData attachmentGetData) { final Pair<InputStream, Effect<Object>> streamWithCloseHandler = resendingAttachmentStreamCreator .getInputStreamWithCloseHandler(attachmentGetData); final Effect<Object> cleanup = streamWithCloseHandler.second(); try { final StoreAttachmentBean storeAttachmentBean = new StoreAttachmentBean.Builder(streamWithCloseHandler.first()) .withSize(attachmentGetData.getSize()) .withKey(attachmentKey) .build(); store.putAttachment(storeAttachmentBean) .then(getFutureCallbackFromEffect(cleanup)); return Unit.VALUE; } catch (final RuntimeException e) { cleanup.apply(Unit.VALUE); throw e; } }