Example usage for java.util.concurrent Callable call

List of usage examples for java.util.concurrent Callable call

Introduction

In this page you can find the example usage for java.util.concurrent Callable call.

Prototype

V call() throws Exception;

Source Link

Document

Computes a result, or throws an exception if unable to do so.

Usage

From source file:com.watchrabbit.executor.spring.config.ClassAnnotatedService.java

public String helloWorld(Callable<String> callable) throws Exception {
    return callable.call();
}

From source file:com.watchrabbit.executor.spring.config.ClassAnnotatedService.java

@Executor(circuitName = "helloWorld2")
public String helloWorld2(Callable<String> callable) throws Exception {
    return callable.call();
}

From source file:com.watchrabbit.executor.spring.config.AnnotatedService.java

public String notMarked(Callable<String> callable) throws Exception {
    return callable.call();
}

From source file:com.watchrabbit.executor.spring.config.AnnotatedService.java

@Executor(circuitName = "helloWorld")
public String helloWorld(Callable<String> callable) throws Exception {
    return callable.call();
}

From source file:com.watchrabbit.executor.spring.config.AnnotatedService.java

@Executor(circuitName = "fastClose", breakerRetryTimeout = 1)
public String fastClose(Callable<String> callable) throws Exception {
    return callable.call();
}

From source file:com.watchrabbit.executor.spring.config.AnnotatedService.java

@Executor(circuitName = "excludedSystemException", excludedExceptions = { SystemException.class })
public String excludedSystemException(Callable<String> callable) throws Exception {
    return callable.call();
}

From source file:com.brienwheeler.lib.db.TransactionWrapper.java

@Transactional
public <T> T doInWriteTransaction(Callable<T> callable) {
    try {/*from   ww w.jav a  2 s  .co  m*/
        return callable.call();
    } catch (RuntimeException e) {
        throw e;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:com.brienwheeler.lib.db.TransactionWrapper.java

@Transactional(propagation = Propagation.REQUIRES_NEW)
public <T> T doInNewWriteTransaction(Callable<T> callable) {
    try {//from w  ww . j  a va 2  s . co  m
        return callable.call();
    } catch (RuntimeException e) {
        throw e;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:com.brienwheeler.lib.db.TransactionWrapper.java

@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public <T> T doInReadTransaction(Callable<T> callable) {
    try {/*from w w w  .  j a  v a2s  .  c om*/
        return callable.call();
    } catch (RuntimeException e) {
        throw e;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:bad.robot.http.apache.ApacheExceptionWrappingExecutor.java

@Override
public <V> V submit(Callable<V> callable) throws HttpException {
    try {/*  ww  w.  j  ava  2  s  .c o m*/
        return callable.call();
    } catch (ConnectTimeoutException e) {
        throw new HttpConnectionTimeoutException(e);
    } catch (SocketTimeoutException e) {
        throw new HttpSocketTimeoutException(e);
    } catch (HttpHostConnectException e) {
        throw new HttpConnectionRefusedException(e);
    } catch (UnknownHostException e) {
        throw new HttpUnknownHostException(e.getMessage(), e);
    } catch (Throwable e) {
        throw new HttpException(e);
    }
}