public IOException getException() throws IllegalStateException { return delegate.getException(); }
public IOException getException() throws IllegalStateException { return parent.getException(); }
@Override public void notify(IoFuture<? extends StreamConnection> ioFuture, Object attachment) { if (ioFuture.getStatus() == IoFuture.Status.FAILED) { listener.failed(ioFuture.getException()); } } }
private static Channel getChannel ( ConnectionProviderContextImpl context, ConnectionHandler ch, OptionMap options ) throws IOException { Channel c; FutureResult<Channel> chResult = new FutureResult<Channel>(context.getExecutor()); ch.open("jmx", chResult, options); IoFuture<Channel> cFuture = chResult.getIoFuture(); Status s2 = cFuture.await(); if ( s2 == Status.FAILED ) { System.err.println("Cannot connect"); if ( cFuture.getException() != null ) { throw new IOException("Connect failed", cFuture.getException()); } } else if ( s2 != Status.DONE ) { cFuture.cancel(); throw new IOException("Connect timeout"); } c = cFuture.get(); return c; }
channel = futureChannel.get(); } else if (result == IoFuture.Status.FAILED) { throw futureChannel.getException(); } else { throw new IOException("Operation failed with status " + result);
/** * {@inheritDoc} */ public void notify(final IoFuture<? extends T> future, A attachment) { switch (future.getStatus()) { case CANCELLED: handleCancelled(attachment); break; case DONE: try { handleDone(future.get(), attachment); } catch (IOException e) { // not possible throw new IllegalStateException(); } break; case FAILED: handleFailed(future.getException(), attachment); break; default: // not possible throw new IllegalStateException(); } }
if ( s == Status.FAILED ) { System.err.println("Cannot connect"); if ( ioFuture.getException() != null ) { ioFuture.getException().printStackTrace(System.err);
connection = futureConnection.get(); } else if (result == IoFuture.Status.FAILED) { throw futureConnection.getException(); } else { throw new IOException("Operation failed with status " + result);
break; case FAILED: throw futureHeader.getException(); default: throw new IOException("Timeout out waiting for header, status=" + result.toString());
void start() throws IOException { sendVersionHeader(); IoFuture<String> futureConnectionId = ConnectionIdReceiver.getConnectionId(channel); IoFuture.Status result = futureConnectionId.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: connectionId = futureConnectionId.get(); mbeanServerConnection = new TheConnection(); localNotificationManager = new LocalNotificationManager(); channel.receiveMessage(new MessageReceiver()); break; case FAILED: throw futureConnectionId.getException(); default: throw new IOException("Unable to obtain connectionId, status=" + result.toString()); } }
VersionedConnection getConnection() throws IOException { sendVersionHeader(); IoFuture<Void> futureWelcome = WelcomeMessageReceiver.awaitWelcomeMessage(channel); IoFuture.Status result = futureWelcome.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: // Set this first as something will need to start handling the response messages. channel.receiveMessage(new MessageReceiver()); break; case FAILED: throw futureWelcome.getException(); default: throw new IOException("Unable to obtain connectionId, status=" + result.toString()); } sendKeyPairs(); String connectionId = begin(); ClientConnection cc = new ClientConnection(channel, environment, clientRequestManager, clientExecutorManager, connectionId); cc.start(); return cc; }
public IOException getException() throws IllegalStateException { return parent.getException(); }
public IOException getException() throws IllegalStateException { return delegate.getException(); }
public static <V> V get(final IoFuture<V> ioFuture, final long timeout, final TimeUnit unit) throws IOException { final IoFuture.Status status = ioFuture.await(timeout, unit); switch (status) { case DONE: return ioFuture.get(); case FAILED: // SaslException is an IOException, which indicates a security or authentication issue, maybe should throw AuthenticationException if(ioFuture.getException() instanceof SaslException) throw ioFuture.getException(); // if it is not a SaslException wrap it in a RuntimeException, should we just wrap it in an IOException ? throw new RuntimeException(ioFuture.getException()); case WAITING: throw new ConnectException("Operation failed with status " + status + " after " + timeout + " " + unit); } // Should we wrap it in an IOException, since we are already throwing it? throw new RuntimeException("Operation failed with status " + status); } }
private V result(final IoFuture.Status status) throws ExecutionException { switch (status) { case CANCELLED: throw new CancellationException(); case FAILED: throw new ExecutionException(ioFuture.getException()); } try { return ioFuture.get(); } catch (IOException e) { throw new ExecutionException(e); } } };
@Override public void notify(IoFuture<? extends StreamConnection> ioFuture, Object attachment) { if (ioFuture.getStatus() == IoFuture.Status.FAILED) { listener.failed(ioFuture.getException()); } } }
@Override public void notify(IoFuture<? extends StreamConnection> ioFuture, Object attachment) { if (ioFuture.getStatus() == IoFuture.Status.FAILED) { listener.failed(ioFuture.getException()); } } }
void start() throws IOException { sendVersionHeader(); IoFuture<String> futureConnectionId = ConnectionIdReceiver.getConnectionId(channel); IoFuture.Status result = futureConnectionId.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: connectionId = futureConnectionId.get(); mbeanServerConnection = new TheConnection(); localNotificationManager = new LocalNotificationManager(); channel.receiveMessage(new MessageReceiver()); break; case FAILED: throw futureConnectionId.getException(); default: throw new IOException("Unable to obtain connectionId, status=" + result.toString()); } }
void start() throws IOException { sendVersionHeader(); IoFuture<String> futureConnectionId = ConnectionIdReceiver.getConnectionId(channel); IoFuture.Status result = futureConnectionId.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: connectionId = futureConnectionId.get(); mbeanServerConnection = new TheConnection(); localNotificationManager = new LocalNotificationManager(); channel.receiveMessage(new MessageReceiver()); break; case FAILED: throw futureConnectionId.getException(); default: throw new IOException("Unable to obtain connectionId, status=" + result.toString()); } }
void start() throws IOException { sendVersionHeader(); IoFuture<String> futureConnectionId = ConnectionIdReceiver.getConnectionId(channel); IoFuture.Status result = futureConnectionId.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: connectionId = futureConnectionId.get(); mbeanServerConnection = new TheConnection(); localNotificationManager = new LocalNotificationManager(); channel.receiveMessage(new MessageReceiver()); break; case FAILED: throw futureConnectionId.getException(); default: throw new IOException("Unable to obtain connectionId, status=" + result.toString()); } }