Example usage for java.lang InterruptedException getCause

List of usage examples for java.lang InterruptedException getCause

Introduction

In this page you can find the example usage for java.lang InterruptedException getCause.

Prototype

public synchronized Throwable getCause() 

Source Link

Document

Returns the cause of this throwable or null if the cause is nonexistent or unknown.

Usage

From source file:org.apache.hadoop.hbase.wal.LogRecoveredEditsOutputSink.java

/**
 * Close all of the output streams./*from   w ww .  j a v a  2s  .  c  o m*/
 * @return the list of paths written.
 */
List<Path> close() throws IOException {
    Preconditions.checkState(!closeAndCleanCompleted);

    final List<Path> paths = new ArrayList<>();
    final List<IOException> thrown = Lists.newArrayList();
    ThreadPoolExecutor closeThreadPool = Threads.getBoundedCachedThreadPool(numThreads, 30L, TimeUnit.SECONDS,
            new ThreadFactory() {
                private int count = 1;

                @Override
                public Thread newThread(Runnable r) {
                    Thread t = new Thread(r, "split-log-closeStream-" + count++);
                    return t;
                }
            });
    CompletionService<Void> completionService = new ExecutorCompletionService<>(closeThreadPool);
    boolean progress_failed;
    try {
        progress_failed = executeCloseTask(completionService, thrown, paths);
    } catch (InterruptedException e) {
        IOException iie = new InterruptedIOException();
        iie.initCause(e);
        throw iie;
    } catch (ExecutionException e) {
        throw new IOException(e.getCause());
    } finally {
        closeThreadPool.shutdownNow();
    }
    if (!thrown.isEmpty()) {
        throw MultipleIOException.createIOException(thrown);
    }
    writersClosed = true;
    closeAndCleanCompleted = true;
    if (progress_failed) {
        return null;
    }
    return paths;
}

From source file:org.openstack.burrow.backend.http.AsyncHttp.java

/**
 * Executes a CreateMessage request by calling .get() on the executeAsync
 * response/*from  ww w.  j  a  v  a2 s.c om*/
 * 
 * @param request The CreateMessage request object to execute
 * @return A Message object
 * @throws CommandException Thrown if cannot process the request
 * @throws ProtocolException Thrown if an error occurs while executing the
 *           Http request
 */
@Override
public Message execute(CreateMessage request) throws CommandException, ProtocolException {
    try {
        return executeAsync(request).get();
    } catch (InterruptedException e) {
        throw new BurrowRuntimeException("InterruptedException executing HTTP request", e);
    } catch (ExecutionException e) {
        Throwable t = e.getCause();
        if (t instanceof CommandException)
            throw (CommandException) t;
        if (t instanceof ProtocolException)
            throw (ProtocolException) t;
        throw new BurrowRuntimeException("ExecutionException executing HTTP request", e);
    }
}

From source file:org.openstack.burrow.backend.http.AsyncHttp.java

/**
 * Executes a DeleteAccounts request by calling .get() on the executeAsync
 * response//from   ww  w  .ja  v a 2 s .c  om
 * 
 * @param request The DeleteAccounts request object to execute
 * @return A List of Message objects
 * @throws CommandException Thrown if cannot process the request
 * @throws ProtocolException Thrown if an error occurs while executing the
 *           Http request
 */
@Override
public List<Account> execute(DeleteAccounts request) throws CommandException, ProtocolException {
    try {
        return executeAsync(request).get();
    } catch (InterruptedException e) {
        throw new BurrowRuntimeException("InterruptedException executing HTTP request", e);
    } catch (ExecutionException e) {
        Throwable t = e.getCause();
        if (t instanceof CommandException)
            throw (CommandException) t;
        if (t instanceof ProtocolException)
            throw (ProtocolException) t;
        throw new BurrowRuntimeException("ExecutionException executing HTTP request", e);
    }
}

From source file:org.openstack.burrow.backend.http.AsyncHttp.java

/**
 * Executes a DeleteMessage request by calling .get() on the executeAsync
 * response/*  ww w. ja v  a2 s .  co m*/
 * 
 * @param request The DeleteMessage request object to execute
 * @return A Message object
 * @throws CommandException Thrown if cannot process the request
 * @throws ProtocolException Thrown if an error occurs while executing the
 *           Http request
 */
@Override
public Message execute(DeleteMessage request) throws CommandException, ProtocolException {
    try {
        return executeAsync(request).get();
    } catch (InterruptedException e) {
        throw new BurrowRuntimeException("InterruptedException executing HTTP request", e);
    } catch (ExecutionException e) {
        Throwable t = e.getCause();
        if (t instanceof CommandException)
            throw (CommandException) t;
        if (t instanceof ProtocolException)
            throw (ProtocolException) t;
        throw new BurrowRuntimeException("ExecutionException executing HTTP request", e);
    }
}

From source file:org.openstack.burrow.backend.http.AsyncHttp.java

/**
 * Executes a DeleteMessages request by calling .get() on the executeAsync
 * response//w ww.j  ava 2  s.  co m
 * 
 * @param request The DeleteMessages request object to execute
 * @return A List of Message objects
 * @throws CommandException Thrown if cannot process the request
 * @throws ProtocolException Thrown if an error occurs while executing the
 *           Http request
 */
@Override
public List<Message> execute(DeleteMessages request) throws CommandException, ProtocolException {
    try {
        return executeAsync(request).get();
    } catch (InterruptedException e) {
        throw new BurrowRuntimeException("InterruptedException executing HTTP request", e);
    } catch (ExecutionException e) {
        Throwable t = e.getCause();
        if (t instanceof CommandException)
            throw (CommandException) t;
        if (t instanceof ProtocolException)
            throw (ProtocolException) t;
        throw new BurrowRuntimeException("ExecutionException executing HTTP request", e);
    }
}

From source file:org.openstack.burrow.backend.http.AsyncHttp.java

/**
 * Executes a DeleteQueues request by calling .get() on the executeAsync
 * response//from  w w  w.j a  va  2s . c  o  m
 * 
 * @param request The DeleteQueues request object to execute
 * @return A List of Queue objects
 * @throws CommandException Thrown if cannot process the request
 * @throws ProtocolException Thrown if an error occurs while executing the
 *           Http request
 */
@Override
public List<Queue> execute(DeleteQueues request) throws CommandException, ProtocolException {
    try {
        return executeAsync(request).get();
    } catch (InterruptedException e) {
        throw new BurrowRuntimeException("InterruptedException executing HTTP request", e);
    } catch (ExecutionException e) {
        Throwable t = e.getCause();
        if (t instanceof CommandException)
            throw (CommandException) t;
        if (t instanceof ProtocolException)
            throw (ProtocolException) t;
        throw new BurrowRuntimeException("ExecutionException executing HTTP request", e);
    }
}

From source file:org.openstack.burrow.backend.http.AsyncHttp.java

/**
 * Executes a GetAccounts request by calling .get() on the executeAsync
 * response/* w  w w.j a v  a2  s  . c o  m*/
 * 
 * @param request The GetAccounts request object to execute
 * @return A List of Account objects
 * @throws CommandException Thrown if cannot process the request
 * @throws ProtocolException Thrown if an error occurs while executing the
 *           Http request
 */
@Override
public List<Account> execute(GetAccounts request) throws CommandException, ProtocolException {
    try {
        return executeAsync(request).get();
    } catch (InterruptedException e) {
        throw new BurrowRuntimeException("InterruptedException executing HTTP request", e);
    } catch (ExecutionException e) {
        Throwable t = e.getCause();
        if (t instanceof CommandException)
            throw (CommandException) t;
        if (t instanceof ProtocolException)
            throw (ProtocolException) t;
        throw new BurrowRuntimeException("ExecutionException executing HTTP request", e);
    }
}

From source file:org.openstack.burrow.backend.http.AsyncHttp.java

/**
 * Executes a GetMessage request by calling .get() on the executeAsync
 * response/* www . ja  v a  2  s . co  m*/
 * 
 * @param request The GetMessage request object to execute
 * @return A Message object
 * @throws CommandException Thrown if cannot process the request
 * @throws ProtocolException Thrown if an error occurs while executing the
 *           Http request
 */
@Override
public Message execute(GetMessage request) throws CommandException, ProtocolException {
    try {
        return executeAsync(request).get();
    } catch (InterruptedException e) {
        throw new BurrowRuntimeException("InterruptedException executing HTTP request", e);
    } catch (ExecutionException e) {
        Throwable t = e.getCause();
        if (t instanceof CommandException)
            throw (CommandException) t;
        if (t instanceof ProtocolException)
            throw (ProtocolException) t;
        throw new BurrowRuntimeException("ExecutionException executing HTTP request", e);
    }
}

From source file:org.openstack.burrow.backend.http.AsyncHttp.java

/**
 * Executes a GetMessages request by calling .get() on the executeAsync
 * response/*from   w  w  w  .ja  v  a2  s  . c  o m*/
 * 
 * @param request The GetMessages request object to execute
 * @return A List of Message objects
 * @throws CommandException Thrown if cannot process the request
 * @throws ProtocolException Thrown if an error occurs while executing the
 *           Http request
 */
@Override
public List<Message> execute(GetMessages request) throws CommandException, ProtocolException {
    try {
        return executeAsync(request).get();
    } catch (InterruptedException e) {
        throw new BurrowRuntimeException("InterruptedException executing HTTP request", e);
    } catch (ExecutionException e) {
        Throwable t = e.getCause();
        if (t instanceof CommandException)
            throw (CommandException) t;
        if (t instanceof ProtocolException)
            throw (ProtocolException) t;
        throw new BurrowRuntimeException("ExecutionException executing HTTP request", e);
    }
}

From source file:org.openstack.burrow.backend.http.AsyncHttp.java

/**
 * Executes a GetQueues request by calling .get() on the executeAsync response
 * /*from w w  w.j  av  a  2  s  .  c  o  m*/
 * @param request The GetQueues request object to execute
 * @return A List of Queue objects
 * @throws CommandException Thrown if cannot process the request
 * @throws ProtocolException Thrown if an error occurs while executing the
 *           Http request
 */
@Override
public List<Queue> execute(GetQueues request) throws CommandException, ProtocolException {
    try {
        return executeAsync(request).get();
    } catch (InterruptedException e) {
        throw new BurrowRuntimeException("InterruptedException executing HTTP request", e);
    } catch (ExecutionException e) {
        Throwable t = e.getCause();
        if (t instanceof CommandException)
            throw (CommandException) t;
        if (t instanceof ProtocolException)
            throw (ProtocolException) t;
        throw new BurrowRuntimeException("ExecutionException executing HTTP request", e);
    }
}