library/src/main/java/com/kdgregory/aws/utils/s3/MultipartUpload.java
/**
     *  Executes a <code>Callable</code> inline, and returns the <code>Future</code>
     *  representing its execution.
     *
     *  // TODO - move to KDGCommons
     */
Executes a Callable inline, and returns the Future
representing its execution.


Executes a Callable inline and returns the Future representing its execution .
private static <T> Future<T> executeInline(Callable<T> callable)
    {
        try
        {
            final T v = callable.call();
            return new Future<T>() {
                @Override
                public boolean cancel(boolean mayInterruptIfRunning)
                {
                    return false;
                }
                @Override
                public boolean isCancelled()
                {
                    return false;
                }
                @Override
                public boolean isDone()
                {
                    return true;
                }
                @Override
                public T get() throws InterruptedException, ExecutionException
                {
                    return v;
                }
                @Override
                public T get(long timeout, TimeUnit unit)
                throws InterruptedException, ExecutionException, TimeoutException
                {
                    return v;
                }
            };
        }
        catch (final Throwable t)
        {
            return new Future<T>() {
                @Override
                public boolean cancel(boolean mayInterruptIfRunning)
                {
                    return false;
                }
                @Override
                public boolean isCancelled()
                {
                    return false;
                }
                @Override
                public boolean isDone()
                {
                    return true;
                }
                @Override
                public T get() throws InterruptedException, ExecutionException
                {
                    throw new ExecutionException(t);
                }
                @Override
                public T get(long timeout, TimeUnit unit)
                throws InterruptedException, ExecutionException, TimeoutException
                {
                    throw new ExecutionException(t);
                }
            };
        }
    }
private static < T > Future < T > executeInline ( Callable < T > callable ) { try { final T v = callable . call ( ) ; return new Future < T > ( ) { @ Override public boolean cancel ( boolean mayInterruptIfRunning ) { return false ; } @ Override public boolean isCancelled ( ) { return false ; } @ Override public boolean isDone ( ) { return true ; } @ Override public T get ( ) throws InterruptedException , ExecutionException { return v ; } @ Override public T get ( long timeout , TimeUnit unit ) throws InterruptedException , ExecutionException , TimeoutException { return v ; } } ; } catch ( final Throwable t ) { return new Future < T > ( ) { @ Override public boolean cancel ( boolean mayInterruptIfRunning ) { return false ; } @ Override public boolean isCancelled ( ) { return false ; } @ Override public boolean isDone ( ) { return true ; } @ Override public T get ( ) throws InterruptedException , ExecutionException { throw new ExecutionException ( t ) ; } @ Override public T get ( long timeout , TimeUnit unit ) throws InterruptedException , ExecutionException , TimeoutException { throw new ExecutionException ( t ) ; } } ; } }
Executes a <code>Callable</code> inline, and returns the <code>Future</code>
  representing its execution.
Executes a <code > Callable< / code > inline and returns the <code > Future< / code > representing its execution .