@Override public void run() { if (!messagingFactory.open.isDone()) { messagingFactory.open.completeExceptionally(new TimeoutException("Opening MessagingFactory timed out.")); messagingFactory.getReactor().stop(); } } },
@Override public void run() { if (!closeTask.isDone()) { closeTask.completeExceptionally(new TimeoutException("Closing MessagingFactory timed out.")); getReactor().stop(); } } },
@Override public void run() { if (TRACE_LOGGER.isWarnEnabled()) { TRACE_LOGGER.warn(String.format(Locale.US, "messagingFactory[%s], hostName[%s], message[%s]", getClientId(), getHostName(), "Processing all pending tasks and closing old reactor.")); } try { rctr.stop(); rctr.process(); } catch (HandlerException e) { if (TRACE_LOGGER.isWarnEnabled()) { TRACE_LOGGER.warn(String.format(Locale.US, "messagingFactory[%s], hostName[%s], error[%s]", getClientId(), getHostName(), ExceptionUtil.toStackTraceString(e, "scheduleCompletePendingTasks - exception occurred while processing events."))); } } finally { rctr.free(); } } }, MessagingFactory.this.getOperationTimeout().getSeconds(), TimeUnit.SECONDS);
private void closeAsync() { // Codes_SRS_AMQPSIOTHUBCONNECTION_15_048 [If the AMQPS connection is already closed, the function shall do nothing.] // Codes_SRS_AMQPSIOTHUBCONNECTION_15_012: [The function shall set the status of the AMQPS connection to CLOSED.] this.state = State.CLOSED; // Codes_SRS_AMQPSIOTHUBCONNECTION_15_013: [The function shall close the AMQPS sender and receiver links, // the AMQPS session and the AMQPS connection.] if (this.sender != null) this.sender.close(); if (this.receiver != null) this.receiver.close(); if (this.session != null) this.session.close(); if (this.connection != null) this.connection.close(); // Codes_SRS_AMQPSIOTHUBCONNECTION_15_014: [The function shall stop the Proton reactor.] this.reactor.stop(); }
this.reactor.stop(); this.reactor.process(); this.reactor.free();
public void run() throws HandlerException { this.reactor.setTimeout(10); this.reactor.start(); while(this.reactor.process()){} this.reactor.stop(); this.reactor.process(); this.reactor.free(); } }
public void run() throws HandlerException { //Codes_SRS_IOTHUBREACTOR_34_003: [This function shall set the timeout of the reactor to 10 milliseconds.] this.reactor.setTimeout(10); this.reactor.start(); //Codes_SRS_IOTHUBREACTOR_34_004: [This function shall start the reactor and have it process indefinitely and stop the reactor when it finishes.] while(this.reactor.process()){} this.reactor.stop(); this.reactor.process(); this.reactor.free(); } }
/** * Main run function to pump Proton messages * @throws HandlerException If Protonj failed. */ public void run() throws HandlerException { this.reactor.setTimeout(REACTOR_TIMEOUT); this.reactor.start(); while(this.reactor.process()){} this.reactor.stop(); this.reactor.process(); this.reactor.free(); } }
this.reactor.stop(); this.reactor.process(); this.reactor.free();
this.rctr.stop();
this.reactor.stop();
this.rctr.stop(); } catch (HandlerException handlerException) { Throwable cause = handlerException.getCause();
if (exception != null && !(exception instanceof CancellationException)) { messagingFactory.open.completeExceptionally(exception); messagingFactory.getReactor().stop();
/** * Private helper for close. * Closes the AmqpsSessionManager, the connection and stops the Proton reactor. */ private void closeAsync() { logger.LogDebug("Entered in method %s", logger.getMethodName()); // Codes_SRS_AMQPSIOTHUBCONNECTION_15_012: [The function shall set the status of the AMQPS connection to DISCONNECTED.] this.state = IotHubConnectionStatus.DISCONNECTED; // Codes_SRS_AMQPSIOTHUBCONNECTION_15_013: [The function shall closeNow the AmqpsSessionManager and the AMQP connection.] this.amqpsSessionManager.closeNow(); if (this.connection != null) { this.connection.close(); } // Codes_SRS_AMQPSIOTHUBCONNECTION_34_014: [If this object's proton reactor is not null, this function shall stop the Proton reactor.] if (this.reactor != null) { this.reactor.stop(); } logger.LogInfo("Proton reactor has been stopped, method name is %s ", logger.getMethodName()); logger.LogDebug("Exited from method %s", logger.getMethodName()); }