Search in sources :

Example 1 with RequestStatus

use of io.joynr.dispatcher.rpc.RequestStatus in project joynr by bmwcarit.

the class Future method onSuccess.

/**
 * Resolves the future using the given result
 *
 * @param result
 *            the result of the asynchronous call
 */
public void onSuccess(T result) {
    try {
        statusLock.lock();
        value = result;
        status = new RequestStatus(RequestStatusCode.OK);
        statusLockChangedCondition.signalAll();
    } catch (Exception e) {
        status = new RequestStatus(RequestStatusCode.ERROR);
        exception = new JoynrRuntimeException(e);
    } finally {
        statusLock.unlock();
    }
}
Also used : JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) JoynrException(io.joynr.exceptions.JoynrException) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) ApplicationException(joynr.exceptions.ApplicationException) JoynrWaitExpiredException(io.joynr.exceptions.JoynrWaitExpiredException) RequestStatus(io.joynr.dispatcher.rpc.RequestStatus)

Example 2 with RequestStatus

use of io.joynr.dispatcher.rpc.RequestStatus in project joynr by bmwcarit.

the class Future method onFailure.

/**
 * Terminates the future in error
 *
 * @param newException
 *            that caused the failure
 */
public void onFailure(JoynrException newException) {
    exception = newException;
    status = new RequestStatus(RequestStatusCode.ERROR);
    try {
        statusLock.lock();
        statusLockChangedCondition.signalAll();
    } finally {
        statusLock.unlock();
    }
}
Also used : RequestStatus(io.joynr.dispatcher.rpc.RequestStatus)

Aggregations

RequestStatus (io.joynr.dispatcher.rpc.RequestStatus)2 JoynrException (io.joynr.exceptions.JoynrException)1 JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)1 JoynrWaitExpiredException (io.joynr.exceptions.JoynrWaitExpiredException)1 ApplicationException (joynr.exceptions.ApplicationException)1