Search in sources :

Example 1 with HandlerException

use of org.apache.qpid.proton.engine.HandlerException in project azure-iot-sdk-java by Azure.

the class ReactorRunner method call.

@Override
public Object call() {
    try {
        String threadName = this.threadPrefix + "-" + THREAD_NAME + "-" + this.threadPostfix;
        Thread.currentThread().setName(threadName);
        this.reactor.setTimeout(10);
        this.reactor.start();
        // noinspection StatementWithEmptyBody
        while (this.reactor.process()) {
        // The empty while loop is to ensure that reactor thread runs as long as it has messages to process
        }
        this.reactor.stop();
        this.reactor.process();
    } catch (HandlerException e) {
        TransportException transportException = new TransportException(e);
        // unclassified exceptions are treated as retryable in ProtonJExceptionParser, so they should be treated
        // the same way here. Exceptions caught here tend to be transient issues.
        transportException.setRetryable(true);
        // Notify the AMQP connection layer so it can tear down the reactor's resources that would usually
        // get cleaned up in a graceful close of the reactor
        this.reactorRunnerStateCallback.onReactorClosedUnexpectedly();
        this.listener.onConnectionLost(transportException, connectionId);
    } finally {
        reactor.free();
    }
    return null;
}
Also used : HandlerException(org.apache.qpid.proton.engine.HandlerException) TransportException(com.microsoft.azure.sdk.iot.device.exceptions.TransportException)

Aggregations

TransportException (com.microsoft.azure.sdk.iot.device.exceptions.TransportException)1 HandlerException (org.apache.qpid.proton.engine.HandlerException)1