/** * Returns a new {@link ConnectFuture} which is already marked as 'failed to connect'. */ public static ConnectFuture newFailedFuture(Throwable exception) { DefaultConnectFuture failedFuture = new DefaultConnectFuture(); failedFuture.setException(exception); return failedFuture; }
public boolean isConnected() { return getValue() instanceof IoSession; }
public void setException(Throwable exception) { setValue(exception); } }
return DefaultConnectFuture.newFailedFuture(new IOException( "Endpoint unavailable: " + address)); DefaultConnectFuture future = new DefaultConnectFuture(); VmPipeSessionImpl localSession = new VmPipeSessionImpl(this, config,getListeners(), VmPipeIdleStatusChecker.getInstance().addSession(localSession); } catch (Throwable t) { future.setException(t); return future;
DefaultConnectFuture future = new DefaultConnectFuture(); newSession(ch, handler, config, future); success = true; return DefaultConnectFuture.newFailedFuture(e); } finally { if (!success && ch != null) { return DefaultConnectFuture.newFailedFuture(e);
initialized = true; } catch (IOException e) { return DefaultConnectFuture.newFailedFuture(e); } finally { if (!initialized && ch != null) { return DefaultConnectFuture.newFailedFuture(e);
@Override public IoSession getSession() throws RuntimeIOException { Object v = getValue(); if (v instanceof RuntimeIOException) { throw (RuntimeIOException) v; } else if (v instanceof Throwable) { throw (RuntimeIOException) new RuntimeIOException( "Failed to get the session.").initCause((Throwable) v); } else { return (IoSession) v; } }
public void setSession(IoSession session) { setValue(session); }