Exemplo n.º 1
0
 public Future<?> executeOnPooledThread(@NotNull final Runnable action) {
   return ourThreadExecutorsService.submit(
       new Runnable() {
         public void run() {
           try {
             action.run();
           } catch (ProcessCanceledException e) {
             // ignore
           } catch (Throwable t) {
             LOG.error(t);
           } finally {
             Thread.interrupted(); // reset interrupted status
           }
         }
       });
 }
Exemplo n.º 2
0
 @Override
 public <T> Future<T> executeOnPooledThread(@NotNull final Callable<T> action) {
   return ourThreadExecutorsService.submit(
       new Callable<T>() {
         public T call() {
           try {
             return action.call();
           } catch (ProcessCanceledException e) {
             // ignore
           } catch (Throwable t) {
             LOG.error(t);
           } finally {
             Thread.interrupted(); // reset interrupted status
           }
           return null;
         }
       });
 }