@Override protected void doClose() { getEndpoint().close(); }
public void close(final OperationResult<Void, Exception> onGraceFullClose) { this.onGraceFullClose = onGraceFullClose; this.sendLink.close(); this.receiveLink.close(); }
/** * Close the links */ public synchronized void closeLinks() { if (this.receiverLink != null) { this.receiverLink.close(); } if (this.senderLink != null) { this.senderLink.close(); } }
@Override public void onEvent() { if (receiveLink != null && receiveLink.getLocalState() != EndpointState.CLOSED) { receiveLink.close(); } else if (receiveLink == null || receiveLink.getRemoteState() == EndpointState.CLOSED) { if (closeTimer != null && !closeTimer.isCancelled()) { closeTimer.cancel(false); } linkClose.complete(null); } } });
@Override protected void afterOpened() { if(validateSharedSubsLinkCapability) { Symbol[] remoteOfferedCapabilities = endpoint.getRemoteOfferedCapabilities(); boolean supported = false; if(remoteOfferedCapabilities != null) { List<Symbol> list = Arrays.asList(remoteOfferedCapabilities); if (list.contains(SHARED_SUBS)) { supported = true; } } if(!supported) { sharedSubsNotSupported = true; if(resourceInfo.isDurable()) { endpoint.detach(); } else { endpoint.close(); } } } }
@Override protected void afterOpened() { if(validateSharedSubsLinkCapability) { Symbol[] remoteOfferedCapabilities = endpoint.getRemoteOfferedCapabilities(); boolean supported = false; if(remoteOfferedCapabilities != null) { List<Symbol> list = Arrays.asList(remoteOfferedCapabilities); if (list.contains(SHARED_SUBS)) { supported = true; } } if(!supported) { sharedSubsNotSupported = true; if(resourceInfo.isDurable()) { endpoint.detach(); } else { endpoint.close(); } } } }
@Override public void onError(Exception exception) { if(!this.openFuture.isDone()) { this.onOpenComplete(exception); } if(this.getIsClosingOrClosed()) { if(!this.closeFuture.isDone()) { TRACE_LOGGER.error("Closing internal send link '{}' of requestresponselink to {} failed.", this.sendLink.getName(), this.parent.linkPath, exception); AsyncUtil.completeFutureExceptionally(this.closeFuture, exception); } } else { TRACE_LOGGER.warn("Internal send link '{}' of requestresponselink to '{}' encountered error.", this.sendLink.getName(), this.parent.linkPath, exception); this.parent.underlyingFactory.deregisterForConnectionError(this.sendLink); this.matchingReceiveLink.close(); this.parent.underlyingFactory.deregisterForConnectionError(this.matchingReceiveLink); this.parent.onInnerLinksClosed(this.linkGeneration, exception); } }
@Override public void onEvent() { if (InternalReceiver.this.receiveLink != null && InternalReceiver.this.receiveLink.getLocalState() != EndpointState.CLOSED) { TRACE_LOGGER.debug("Closing internal receive link of requestresponselink to {}", RequestResponseLink.this.linkPath); InternalReceiver.this.receiveLink.close(); InternalReceiver.this.parent.underlyingFactory.deregisterForConnectionError(InternalReceiver.this.receiveLink); if(waitForCloseCompletion) { RequestResponseLink.scheduleLinkCloseTimeout(InternalReceiver.this.closeFuture, InternalReceiver.this.parent.underlyingFactory.getOperationTimeout(), InternalReceiver.this.receiveLink.getName()); } else { AsyncUtil.completeFuture(InternalReceiver.this.closeFuture, null); } } } });
@Override protected void closeOrDetachEndpoint() { if (getResourceInfo().isDurable()) { getEndpoint().detach(); } else { getEndpoint().close(); } }
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 protected void closeOrDetachEndpoint() { if (getResourceInfo().isDurable()) { getEndpoint().detach(); } else { getEndpoint().close(); } }
public void addReceiver(Receiver receiver) throws Exception { try { AbstractProtonReceiverContext protonReceiver = new ProtonServerReceiverContext(sessionSPI, connection, this, receiver); protonReceiver.initialise(); receivers.put(receiver, protonReceiver); receiver.setContext(protonReceiver); receiver.open(); } catch (ActiveMQAMQPException e) { receivers.remove(receiver); receiver.setTarget(null); receiver.setCondition(new ErrorCondition(e.getAmqpError(), e.getMessage())); receiver.close(); } }
/** * Closes receiver and sender link if they are not null */ protected void closeLinks() { logger.LogDebug("Entered in method %s", logger.getMethodName()); // Codes_SRS_AMQPSDEVICEOPERATIONS_12_011: [If the sender link is not null the function shall close it and sets it to null.] if (this.senderLink != null) { this.senderLink.close(); this.senderLink = null; } // Codes_SRS_AMQPSDEVICEOPERATIONS_12_012: [If the receiver link is not null the function shall close it and sets it to null.] if (this.receiverLink != null) { this.receiverLink.close(); this.receiverLink = null; } this.amqpsSendLinkState = AmqpsDeviceOperationLinkState.CLOSED; this.amqpsRecvLinkState = AmqpsDeviceOperationLinkState.CLOSED; logger.LogDebug("Exited from method %s", logger.getMethodName()); }
public void addReceiver(Receiver receiver) throws Exception { try { ProtonServerReceiverContext protonReceiver = new ProtonServerReceiverContext(sessionSPI, connection, this, receiver); protonReceiver.initialise(); receivers.put(receiver, protonReceiver); ServerProducer serverProducer = new ServerProducerImpl(receiver.getName(), "AMQP", receiver.getTarget().getAddress()); sessionSPI.addProducer(serverProducer); receiver.setContext(protonReceiver); connection.runNow(() -> { receiver.open(); connection.flush(); }); } catch (ActiveMQAMQPException e) { receivers.remove(receiver); receiver.setTarget(null); receiver.setCondition(new ErrorCondition(e.getAmqpError(), e.getMessage())); connection.runNow(() -> { receiver.close(); connection.flush(); }); } } }
public void addReceiver(Receiver receiver) throws Exception { try { ProtonServerReceiverContext protonReceiver = new ProtonServerReceiverContext(sessionSPI, connection, this, receiver); protonReceiver.initialise(); receivers.put(receiver, protonReceiver); ServerProducer serverProducer = new ServerProducerImpl(receiver.getName(), "AMQP", receiver.getTarget().getAddress()); sessionSPI.addProducer(serverProducer); receiver.setContext(protonReceiver); connection.lock(); try { receiver.open(); } finally { connection.unlock(); } } catch (ActiveMQAMQPException e) { receivers.remove(receiver); receiver.setTarget(null); receiver.setCondition(new ErrorCondition(e.getAmqpError(), e.getMessage())); connection.lock(); try { receiver.close(); } finally { connection.unlock(); } } } }