@Override public ProtonSessionImpl close() { session.close(); getConnectionImpl().flush(); return this; }
@Override public void onRemoteClose(Session session) throws Exception { synchronized (getLock()) { session.close(); } AbstractProtonSessionContext sessionContext = (AbstractProtonSessionContext) session.getContext(); if (sessionContext != null) { sessionContext.close(); sessions.remove(session); session.setContext(null); } }
private void closeSession(Link link, ErrorCondition condition) { final Session session = link.getSession(); if (session != null && session.getLocalState() != EndpointState.CLOSED) { if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format("closeSession for linkName[%s], errorCondition[%s], errorDescription[%s]", link.getName(), condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } session.setCondition(condition); session.close(); } }
@Override public void onRemoteClose(Session session) throws Exception { handler.runLater(() -> { session.close(); session.free(); AMQPSessionContext sessionContext = (AMQPSessionContext) session.getContext(); if (sessionContext != null) { sessionContext.close(); sessions.remove(session); session.setContext(null); } }); }
private void closeSession(Link link) { if (link.getSession() != null && link.getSession().getLocalState() != EndpointState.CLOSED) link.getSession().close(); } }
protected void processSessionClose(Session protonSession) throws Exception { if (protonSession.getContext() != null) { ((AmqpResource) protonSession.getContext()).close(); } else { protonSession.close(); protonSession.free(); } }
protected void processSessionClose(Session protonSession) throws Exception { if (protonSession.getContext() != null) { ((AmqpResource) protonSession.getContext()).close(); } else { protonSession.close(); protonSession.free(); } }
session.close(); this.onRemoteSessionOpenError.accept( null,
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(); }
@Override public void onSessionRemoteClose(Event e) { if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format(Locale.US, "onSessionRemoteClose entityName[%s], condition[%s]", this.entityName, e.getSession().getRemoteCondition() == null ? "none" : e.getSession().getRemoteCondition().toString())); } final Session session = e.getSession(); ErrorCondition condition = session != null ? session.getRemoteCondition() : null; if (session != null && session.getLocalState() != EndpointState.CLOSED) { if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format(Locale.US, "onSessionRemoteClose closing a local session for entityName[%s], condition[%s], description[%s]", this.entityName, condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } session.setCondition(session.getRemoteCondition()); session.close(); } this.sessionOpenErrorDispatched = true; if (!sessionCreated && this.onRemoteSessionOpenError != null) this.onRemoteSessionOpenError.accept(condition, null); }
@Override public void onResponse(AmqpProtocolConverter converter, Response response) throws IOException { getEndpoint().setContext(null); getEndpoint().close(); getEndpoint().free(); } });
@Override public void onRemoteClose(Session session) throws Exception { lock(); try { session.close(); session.free(); } finally { unlock(); } AMQPSessionContext sessionContext = (AMQPSessionContext) session.getContext(); if (sessionContext != null) { sessionContext.close(); sessions.remove(session); session.setContext(null); } }
@Override public void onResponse(AmqpProtocolConverter converter, Response response) throws IOException { getEndpoint().setContext(null); getEndpoint().close(); getEndpoint().free(); } });
@Override public void onSessionRemoteClose(Event e) { TRACE_LOGGER.debug("onSessionRemoteClose - entityName: {}, condition: {}", this.name, e.getSession().getCondition() == null ? "none" : e.getSession().getCondition().toString()); Session session = e.getSession(); if (session != null && session.getLocalState() != EndpointState.CLOSED) { session.close(); } }
/** * Close the Proton objects and the schedulers. * After calling this function all resource freed. * */ void closeNow() { logger.LogDebug("Entered in method %s", logger.getMethodName()); // Codes_SRS_AMQPSESSIONMANAGER_12_043: [THe function shall shut down the scheduler.] this.shutDownScheduler(); // Codes_SRS_AMQPSESSIONMANAGER_12_010: [The function shall call all device session to closeNow links.] for (int i = 0; i < this.amqpsDeviceSessionList.size(); i++) { if (this.amqpsDeviceSessionList.get(i) != null) { this.amqpsDeviceSessionList.get(i).close(); } } // Codes_SRS_AMQPSESSIONMANAGER_12_011: [The function shall closeNow the authentication links.] this.amqpsDeviceAuthentication.closeLinks(); // Codes_SRS_AMQPSESSIONMANAGER_12_012: [The function shall closeNow the session.] if (this.session != null) { this.session.close(); this.session = null; } logger.LogDebug("Exited from method %s", logger.getMethodName()); }
@Override public void onDelivery(Event event) { //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_023: [ The event handler shall get the Delivery from the event only if the event type is DELIVERY **]** if(event.getType() == Event.Type.DELIVERY) { // Codes_SRS_AMQPSIOTHUBCONNECTION_15_038: [If this link is the Sender link and the event type is DELIVERY, the event handler shall get the Delivery (Proton) object from the event.] Delivery d = event.getDelivery(); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_024: [ The event handler shall get the Delivery remote state from the delivery **]** DeliveryState remoteState = d.getRemoteState(); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_025: [ The event handler shall verify the Amqp response and add the response to a queue. **]** sendStatusQueue.add(new AmqpResponseVerification(remoteState)); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_026: [ The event handler shall settle the delivery. **]** d.settle(); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_027: [ The event handler shall get the Sender (Proton) object from the event **]** Sender snd = event.getSender(); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_028: [ The event handler shall close the Sender, Session and Connection **]** snd.close(); snd.getSession().close(); snd.getSession().getConnection().close(); isConnected = false; } }
recv.getSession().close(); recv.getSession().getConnection().close();
@Override public void accept(Session session) { if (MessageSender.this.getIsClosingOrClosed()) { session.close(); return; } final Sender sender = session.sender(TrackingUtil.getLinkName(session)); final Target target = new Target(); target.setAddress(sendPath); sender.setTarget(target); final Source source = new Source(); sender.setSource(source); sender.setSenderSettleMode(SenderSettleMode.UNSETTLED); final SendLinkHandler handler = new SendLinkHandler(MessageSender.this); BaseHandler.setHandler(sender, handler); if (MessageSender.this.sendLink != null) { MessageSender.this.underlyingFactory.deregisterForConnectionError(MessageSender.this.sendLink); } MessageSender.this.underlyingFactory.registerForConnectionError(sender); sender.open(); synchronized (MessageSender.this.errorConditionLock) { MessageSender.this.sendLink = sender; } } };
recv.getSession().close(); recv.getSession().getConnection().close();
session.close(); return;