@Override public T call() throws BackgroundException { try { return new DefaultRetryCallable<T>(new BackgroundExceptionCallable<T>() { @Override public T call() throws BackgroundException { // Reset status SessionBackgroundAction.this.reset(); // Run action return SessionBackgroundAction.this.run(); } }, this, this).call(); } catch(ConnectionCanceledException e) { throw e; } catch(BackgroundException e) { failed = true; throw e; } }
log.info(String.format("Submit part %d of %s to queue with offset %d and length %d", partNumber, file, offset, length)); return pool.execute(new DefaultRetryCallable<B2UploadPartResponse>(new BackgroundExceptionCallable<B2UploadPartResponse>() { @Override public B2UploadPartResponse call() throws BackgroundException {
@Override public T call() throws BackgroundException { while(!cancel.isCanceled()) { try { return delegate.call(); } catch(BackgroundException e) { if(!this.retry(e, listener, cancel)) { throw e; } // Try again } } throw new ConnectionCanceledException(); } }
private Future<StorageObject> submit(final ThreadPool pool, final Path segment, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus overall, final Long offset, final Long length, final ConnectionCallback callback) { return pool.execute(new DefaultRetryCallable<StorageObject>(new BackgroundExceptionCallable<StorageObject>() { @Override public StorageObject call() throws BackgroundException {
@Override public void write(final byte[] content, final int off, final int len) throws IOException { try { completed.add(new DefaultRetryCallable<StorageObject>(new BackgroundExceptionCallable<StorageObject>() { @Override public StorageObject call() throws BackgroundException { return stored; }, overall).call());
log.info(String.format("Submit part %d of %s to queue with offset %d and length %d", partNumber, file, offset, length)); return pool.execute(new DefaultRetryCallable<MultipartPart>(new BackgroundExceptionCallable<MultipartPart>() { @Override public MultipartPart call() throws BackgroundException {
@Override public void write(final byte[] content, final int off, final int len) throws IOException { try { completed.add(new DefaultRetryCallable<MultipartPart>(new BackgroundExceptionCallable<MultipartPart>() { @Override public MultipartPart call() throws BackgroundException { part.getContentLength()); }, overall).call());
.addPart("file", new ByteArrayBody(content, file.getName())) .build(); new DefaultRetryCallable<Void>(new BackgroundExceptionCallable<Void>() { @Override public Void call() throws BackgroundException { }, overall).call();
log.debug(String.format("Write segment %d for upload %s", segment, version)); completed.add(new DefaultRetryCallable<B2UploadPartResponse>(new BackgroundExceptionCallable<B2UploadPartResponse>() { @Override public B2UploadPartResponse call() throws BackgroundException { }, new DisabledProgressListener(), new TransferBackgroundActionState(overall)).call());