@Override public void onEvent() { if (!MessageSender.this.getIsClosingOrClosed() && (sendLink.getLocalState() == EndpointState.CLOSED || sendLink.getRemoteState() == EndpointState.CLOSED)) { recreateSendLink(); } } });
@Override public void onEvent() { if (!MessageSender.this.getIsClosingOrClosed() && (sendLink == null || sendLink.getLocalState() == EndpointState.CLOSED || sendLink.getRemoteState() == EndpointState.CLOSED)) { recreateSendLink(); } } });
@Override public void onEvent() { if (sendLink != null && sendLink.getLocalState() != EndpointState.CLOSED) { sendLink.close(); } else if (sendLink == null || sendLink.getRemoteState() == EndpointState.CLOSED) { if (closeTimer != null && !closeTimer.isCancelled()) { closeTimer.cancel(false); } linkClose.complete(null); } } });
@Override public IOObjectState getState() { if (sendLink.getLocalState() == EndpointState.UNINITIALIZED || receiveLink.getLocalState() == EndpointState.UNINITIALIZED || sendLink.getRemoteState() == EndpointState.UNINITIALIZED || receiveLink.getRemoteState() == EndpointState.UNINITIALIZED) return IOObjectState.OPENING; if (sendLink.getRemoteState() == EndpointState.ACTIVE && receiveLink.getRemoteState() == EndpointState.ACTIVE && sendLink.getLocalState() == EndpointState.ACTIVE && receiveLink.getRemoteState() == EndpointState.ACTIVE) return IOObjectState.OPENED; if (sendLink.getRemoteState() == EndpointState.CLOSED && receiveLink.getRemoteState() == EndpointState.CLOSED) return IOObjectState.CLOSED; return IOObjectState.CLOSING; // only left cases are if some are active and some are closed }
private synchronized CompletableFuture<Void> ensureLinkIsOpen() if (!(this.sendLink.getLocalState() == EndpointState.ACTIVE && this.sendLink.getRemoteState() == EndpointState.ACTIVE))
public CompletableFuture<Message> requestAysnc(Message requestMessage, TransactionContext transaction, Duration timeout) { this.throwIfClosed(null); CompletableFuture<Message> responseFuture = new CompletableFuture<Message>(); RequestResponseWorkItem workItem = new RequestResponseWorkItem(requestMessage, transaction, responseFuture, timeout); String requestId = "request:" + this.requestCounter.incrementAndGet(); requestMessage.setMessageId(requestId); requestMessage.setReplyTo(this.replyTo); this.pendingRequests.put(requestId, workItem); workItem.setTimeoutTask(this.scheduleRequestTimeout(requestId, timeout)); TRACE_LOGGER.debug("Sending request with id:{}", requestId); this.amqpSender.sendRequest(requestId, false); // Check and recreate links if necessary if(!((this.amqpSender.sendLink.getLocalState() == EndpointState.ACTIVE && this.amqpSender.sendLink.getRemoteState() == EndpointState.ACTIVE) && (this.amqpReceiver.receiveLink.getLocalState() == EndpointState.ACTIVE && this.amqpReceiver.receiveLink.getRemoteState() == EndpointState.ACTIVE))) { this.ensureUniqueLinkRecreation(); } return responseFuture; }
while(this.sendLink != null && this.sendLink.getLocalState() == EndpointState.ACTIVE && this.sendLink.getRemoteState() == EndpointState.ACTIVE && this.availableCredit.get() > 0)
private void processSendWork() { if (this.sendLink.getLocalState() == EndpointState.CLOSED || this.sendLink.getRemoteState() == EndpointState.CLOSED) { if (!this.getIsClosingOrClosed()) this.recreateSendLink(); while (this.sendLink.getLocalState() == EndpointState.ACTIVE && this.sendLink.getRemoteState() == EndpointState.ACTIVE && this.sendLink.getCredit() > 0) { final WeightedDeliveryTag weightedDelivery;
private void onLinkOpenComplete(final Exception exception) { if (openRefCount.decrementAndGet() <= 0 && onOpen != null) if (exception == null && this.sendLink.getRemoteState() == EndpointState.ACTIVE && this.receiveLink.getRemoteState() == EndpointState.ACTIVE) onOpen.onComplete(null); else { if (exception != null) onOpen.onError(exception); else { final ErrorCondition error = (this.sendLink.getRemoteCondition() != null && this.sendLink.getRemoteCondition().getCondition() != null) ? this.sendLink.getRemoteCondition() : this.receiveLink.getRemoteCondition(); onOpen.onError(ExceptionUtil.toException(error)); } } }
&& sendLinkCurrent.getLocalState() == EndpointState.ACTIVE && sendLinkCurrent.getRemoteState() == EndpointState.ACTIVE && this.linkCredit > 0)