@Override public Throwable cause() { return connectFuture.getException(); } }
@Override public Throwable cause() { return connectFuture.getException(); } }
@Override public Throwable cause() { return connectFuture.getException(); } }
private void send() throws IOException { try { future.await(); } catch (InterruptedException e) { if (future.getException() != null) { throw new IOException(future.getException()); } throw new IOException(e); } if (future.getException() != null) { throw new IOException(future.getException()); } buffer.flip(); future.getSession().write(buffer); } public void close() throws IOException {
@Override public void operationComplete(ConnectFuture future) { if (logger.isTraceEnabled()) { logger.trace(format("ServiceHeartBeat.run.connectFuture.operationComplete (%s): nextDelay is %d", connectURI, nextDelay.get())); } Throwable t = future.getException(); if ((t != null) && (t instanceof IllegalStateException)) { // do not reschedule the heartbeatTask as the connector is being shut down if (logger.isTraceEnabled()) { logger.trace("ServiceHeartBeat.run.connectFuture.Completed: not rescheduling as connector is being shut down.", t); } return; } if ( nextDelay.get() != 0 ) { schedule(nextDelay.get()); } } });
private void send() throws IOException { try { future.await(); } catch (InterruptedException e) { if (future.getException() != null) { throw new IOException(future.getException()); } throw new IOException(e); } if (future.getException() != null) { throw new IOException(future.getException()); } buffer.flip(); future.getSession().write(buffer); } public void close() throws IOException {
@Override public void operationComplete(ConnectFuture future) { try { Throwable e = future.getException(); // If we failed to bind to the outgoing port... if (e != null && e instanceof BindException) { synchronized(m_portMutex) { // ... then reset the port LOG.warn("Resetting outgoing TCP port, value was {}", m_port.get()); m_port.set(null); } // and reattempt the connection connect(remoteAddress, init, handler); } } catch (RuntimeIoException e) { LOG.debug("Exception of type {} caught, disposing of connector: {}", e.getClass().getName(), Thread.currentThread().getName(), e); // This will be thrown in the event of a ConnectException for example connector.dispose(); } } };
@Override public void operationComplete(ConnectFuture future) { try { Throwable e = future.getException(); // If we failed to bind to the outgoing port... if (e != null && e instanceof BindException) { synchronized(m_portMutex) { // ... then reset the port m_port = null; } // and reattempt the connection connect(remoteAddress, init, handler); } } catch (RuntimeIoException e) { LOG.debug("Exception of type {} caught, disposing of connector: {}", e.getClass().getName(), Thread.currentThread().getName(), e); // This will be thrown in the event of a ConnectException for example connector.dispose(); } } };
@Override public void operationComplete(ConnectFuture future) { // fail bridge connect future if parent connect fails if (!future.isConnected()) { wseConnectFuture.setException(future.getException()); } } };
@Override public void operationComplete(ConnectFuture future) { // fail bridge connect future if parent connect fails if (!future.isConnected()) { bridgeConnectFuture.setException(future.getException()); } } };
@Override public void operationComplete(ConnectFuture future) { // fail bridge connect future if parent connect fails if (!future.isConnected()) { bridgeConnectFuture.setException(future.getException()); } } }
@Override public void operationComplete(ConnectFuture future) { // fail bridge connect future if parent connect fails if ( !future.isConnected() ) { wsnConnectFuture.setException(future.getException()); } }
@Override public void operationComplete(ConnectFuture future) { // fail bridge connect future if parent connect fails if (!future.isConnected()) { sseConnectFuture.setException(future.getException()); } } };
@Override public void operationComplete(ConnectFuture future) { // fail bridge connect future if parent connect fails if (!future.isConnected()) { sslConnectFuture.setException(future.getException()); } } };
protected synchronized void handleConnectComplete ( final ConnectFuture future ) { logger.debug ( "Connection attempt complete: {}", future ); if ( this.connectFuture != future ) { logger.warn ( "handleConnectComplete got called with wrong future - current: {}, called: {}", this.connectFuture, future ); return; } this.connectFuture = null; final Throwable error = future.getException (); if ( error != null ) { setState ( ConnectionState.CLOSED, error ); return; } try { setSession ( future.getSession () ); } catch ( final Throwable e ) { setState ( ConnectionState.CLOSED, e ); } logger.debug ( "Connection established" ); }
@Override public void operationComplete(ConnectFuture future) { final Throwable cause = future.getException(); if (cause != null) { if (cause instanceof IOException) { if (retryAttempt == 0) { LOG.info("Service {} detected false: {}: {}",getServiceName(), cause.getClass().getName(), cause.getMessage()); detectFuture.setServiceDetected(false); } else { LOG.info("Connection exception occurred: {} for service {}, retrying attempt {}", cause, getServiceName(), retryAttempt); future = m_connectionFactory.reConnect(address, init, createDetectorHandler(detectFuture)); future.addListener(retryAttemptListener(detectFuture, address, init, retryAttempt - 1)); } } else { LOG.info("Threw a Throwable and detection is false for service {}", getServiceName(), cause); detectFuture.setServiceDetected(false); } } } };
@Override public void operationComplete(IoFuture future) { if (future.isDone()) { if (logger.isInfoEnabled()) { logger.info("[JobX] MinaRPC sent success, request id:{}", rpcFuture.getRequest().getId()); } return; } else { if (logger.isInfoEnabled()) { logger.info("[JobX] MinaRPC sent failure, request id:{}", rpcFuture.getRequest().getId()); } if (rpcFuture != null) { rpcFuture.caught(getConnect(rpcFuture.getRequest()).getException()); } } futureTable.remove(rpcFuture.getRequest().getId()); }
} else { if (logger.isWarnEnabled()) { logger.warn("[JobX] MinaRPC getConnect: connect remote host[" + request.getAddress() + "] failed, " + connectFuture.toString(), connectFuture.getException());
private <T extends ConnectFuture> void connectUsingNewTransport(final ConnectFuture connectFuture, ResourceAddress address, HttpConnectSessionFactory httpSessionFactory) { // propagate connection failure, if necessary IoFutureListener<ConnectFuture> parentConnectListener = future -> { // fail bridge connect future if parent connect fails if (!future.isConnected()) { connectFuture.setException(future.getException()); } }; ResourceAddress transportAddress = address.getTransport(); BridgeConnector connector = bridgeServiceFactory.newBridgeConnector(transportAddress); IoSessionInitializer<ConnectFuture> parentInitializer = createParentInitializer(address, connectFuture, httpSessionFactory); connector.connect(transportAddress, bridgeHandler, parentInitializer).addListener(parentConnectListener); }
public boolean connect() { if ( session != null && session.isConnected() ) { throw new IllegalStateException( "Already connected. Disconnect first." ); } try { this.connector.getFilterChain().addLast( "codec", new ProtocolCodecFilter( new ObjectSerializationCodecFactory() ) ); ConnectFuture future1 = this.connector.connect( this.address ); future1.await( 2000 ); if ( !future1.isConnected() ) { eventListener.info( "unable to connect : " + address + " : " + future1.getException() ); return false; } eventListener.info( "connected : " + address ); this.session = future1.getSession(); return true; } catch ( Exception e ) { e.printStackTrace(); return false; } }