public EndpointState getRemoteState() { return connection.getRemoteState(); }
@Override public void onConnectionUnbound(Event event) { final Connection connection = event.getConnection(); if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format(Locale.US, "onConnectionUnbound: hostname[%s], state[%s], remoteState[%s]", connection.getHostname(), connection.getLocalState(), connection.getRemoteState())); } // if failure happened while establishing transport - nothing to free up. if (connection.getRemoteState() != EndpointState.UNINITIALIZED) connection.free(); }
@Override public void onTransportClosed(Event event) { final Connection connection = event.getConnection(); final Transport transport = event.getTransport(); final ErrorCondition condition = transport.getCondition(); if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format(Locale.US, "onTransportClosed: hostname[%s], error[%s]", connection != null ? connection.getHostname() : "n/a", (condition != null ? condition.getDescription() : "n/a"))); } if (connection != null && connection.getRemoteState() != EndpointState.CLOSED) { // if the remote-peer abruptly closes the connection without issuing close frame // issue one this.amqpConnection.onConnectionError(condition); } }
@Override public void onConnectionLocalClose(Event event) { final Connection connection = event.getConnection(); final ErrorCondition error = connection.getCondition(); if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format(Locale.US, "onConnectionLocalClose: hostname[%s], errorCondition[%s], errorDescription[%s]", connection.getHostname(), error != null ? error.getCondition() : "n/a", error != null ? error.getDescription() : "n/a")); } if (connection.getRemoteState() == EndpointState.CLOSED) { // This means that the CLOSE origin is Service final Transport transport = connection.getTransport(); if (transport != null) { transport.unbind(); // we proactively dispose IO even if service fails to close } } }
@Override public void onTransportError(Event event) { final Connection connection = event.getConnection(); final Transport transport = event.getTransport(); final ErrorCondition condition = transport.getCondition(); if (TRACE_LOGGER.isWarnEnabled()) { TRACE_LOGGER.warn(String.format(Locale.US, "onTransportError: hostname[%s], error[%s]", connection != null ? connection.getHostname() : "n/a", condition != null ? condition.getDescription() : "n/a")); } if (connection != null && connection.getRemoteState() != EndpointState.CLOSED) { // if the remote-peer abruptly closes the connection without issuing close frame // issue one this.amqpConnection.onConnectionError(condition); } // onTransportError event is not handled by the global IO Handler for cleanup transport.unbind(); this.notifyTransportErrors(event); }
@Override public void onConnectionLocalClose(Event event) { Connection connection = event.getConnection(); TRACE_LOGGER.debug("onConnectionLocalClose: hostname:{}", connection.getHostname()); if(connection.getRemoteState() == EndpointState.CLOSED) { // Service closed it first. In some such cases transport is not unbound and causing a leak. if(connection.getTransport() != null) { connection.getTransport().unbind(); } connection.free(); } } }
@Override public void onConnectionLocalOpen(Event event) { Connection connection = event.getConnection(); if (connection.getRemoteState() != EndpointState.UNINITIALIZED) { return; } Transport transport = Proton.transport(); transport.sasl(); transport.setEmitFlowEventOnSend(false); transport.bind(connection); }
Connection getConnection() { if (this.connection == null || this.connection.getLocalState() == EndpointState.CLOSED || this.connection.getRemoteState() == EndpointState.CLOSED) { TRACE_LOGGER.info("Creating connection to host '{}:{}'", this.connectionHandler.getOutboundSocketHostName(), this.connectionHandler.getOutboundSocketPort()); this.connection = this.getReactor().connectionToHost( this.connectionHandler.getOutboundSocketHostName(), this.connectionHandler.getOutboundSocketPort(), this.connectionHandler); } return this.connection; }
boolean checkSettled(Iterator<Delivery> unsettled) { if (unsettled != null) { while (unsettled.hasNext()) { Delivery d = unsettled.next(); if (d == null) { break; } if (d.getRemoteState() != null || d.remotelySettled()) { d.settle(); } else if (d.getLink().getSession().getConnection().getRemoteState() == EndpointState.CLOSED) { continue; } else { return false; } } } return true; } }
if (this.connection != null && this.connection.getRemoteState() != EndpointState.CLOSED)
private void performConnectionOpen(Connection connection, InputStream in, OutputStream out) throws IOException, LoginException { connection.setHostname(saslHostname); connection.setContainer(container); connection.setDesiredCapabilities(new Symbol[] {CAPABILITY_ADDRESS_AUTHZ}); connection.open(); writeToNetwork(connection, out); readFromNetwork(connection, in, () -> connection.getRemoteState() == EndpointState.UNINITIALIZED); }
private void handleOpen(Event event) { Connection connection = event.getConnection(); if (connection.getRemoteState() != EndpointState.UNINITIALIZED) { return; } Transport transport = Proton.transport(); Sasl sasl = transport.sasl(); sasl.client(); sasl.setMechanisms("ANONYMOUS"); transport.webSocket(); transport.bind(connection); }
} else { future.sync(connectTimeout, TimeUnit.MILLISECONDS); if (getEndpoint().getRemoteState() != EndpointState.ACTIVE) { throw new IOException("Failed to connect after configured timeout.");
if (connection != null && connection.getRemoteState() != EndpointState.CLOSED && connection.getLocalState() != EndpointState.CLOSED) { connection.close();
@Override public Session getSession(final String path, final Consumer<Session> onRemoteSessionOpen, final BiConsumer<ErrorCondition, Exception> onRemoteSessionOpenError) { if (this.getIsClosingOrClosed()) { onRemoteSessionOpenError.accept(null, new OperationCancelledException("underlying messagingFactory instance is closed")); return null; } if (this.connection == null || this.connection.getLocalState() == EndpointState.CLOSED || this.connection.getRemoteState() == EndpointState.CLOSED) { this.connection = this.getReactor().connectionToHost( this.connectionHandler.getRemoteHostName(), this.connectionHandler.getRemotePort(), this.connectionHandler); } final Session session = this.connection.session(); BaseHandler.setHandler(session, new SessionHandler(path, onRemoteSessionOpen, onRemoteSessionOpenError, this.operationTimeout)); session.open(); return session; }
if (protonConnection.getLocalState() == EndpointState.UNINITIALIZED && protonConnection.getRemoteState() != EndpointState.UNINITIALIZED) {
if (protonConnection.getLocalState() == EndpointState.UNINITIALIZED && protonConnection.getRemoteState() != EndpointState.UNINITIALIZED) {
private void handleOpen(Reactor reactor, Event event) { Connection connection = event.getConnection(); if (connection.getRemoteState() != EndpointState.UNINITIALIZED) { return;
logger.entry(this, methodName, event); if (event.getConnection().getRemoteState() == EndpointState.CLOSED) { final ErrorCondition remoteCondition = event.getConnection().getRemoteCondition(); final EngineConnection engineConnection = (EngineConnection)event.getConnection().getContext(); } else if (event.getConnection().getRemoteState() == EndpointState.ACTIVE) { EngineConnection engineConnection = (EngineConnection)event.getConnection().getContext(); long now = System.currentTimeMillis();
if (connection.getRemoteState() == EndpointState.CLOSED)