void start() { channel.receiveMessage(receiver); }
void start() { channel.receiveMessage(new Channel.Receiver() { public void handleError(final Channel channel, final IOException error) { safeClose(channel); } public void handleEnd(final Channel channel) { safeClose(channel); } public void handleMessage(final Channel channel, final MessageInputStream message) { try { final int messageId = message.readUnsignedByte(); final int id = readId(message, version); final int result = message.readUnsignedByte(); if (result == Protocol.SUCCESS || result == Protocol.FAILURE) { tracker.signalResponse(id, messageId, message, true); } else { throw Messages.log.outcomeNotUnderstood(); } channel.receiveMessage(this); } catch (IOException e) { safeClose(channel); safeClose(message); } } }); }
public void channelOpened(Channel channel) { log.trace("Channel Opened"); try { writeVersionHeader(channel, false); channel.receiveMessage(new ClientVersionReceiver(serverMessageInterceptorFactory.create(channel))); } catch (IOException e) { log.error("Unable to send header, closing channel", e); IoUtils.safeClose(channel); } }
public static IoFuture<InitialHeader> getInitialHeader(final Channel channel) { VersionedIoFuture<InitialHeader> future = new VersionedIoFuture<InitialHeader>(); channel.receiveMessage(new ClientVersionReceiver(future)); return future; }
public static IoFuture<Void> awaitWelcomeMessage(final Channel channel) { VersionedIoFuture<Void> future = new VersionedIoFuture<Void>(); channel.receiveMessage(new WelcomeMessageReceiver(future)); return future; }
void start() throws IOException { // Create a connection ID connectionId = UUID.randomUUID(); log.debugf("Created connectionID %s", connectionId.toString()); // Inform server the connection is now open server.connectionOpened(this); channel.receiveMessage(new MessageReciever()); }
public static IoFuture<String> getConnectionId(final Channel channel) { VersionedIoFuture<String> future = new VersionedIoFuture<String>(); channel.receiveMessage(new ConnectionIdReceiver(future)); return future; }
} finally { channel.receiveMessage(this);
void start() throws IOException { // Create a connection ID connectionId = UUID.randomUUID(); log.debugf("Created connectionID %s", connectionId.toString()); // Send ID to client sendConnectionId(); // Inform server the connection is now open server.connectionOpened(this); channel.receiveMessage(new MessageReciever()); }
private static IoFuture<TransactionClientChannel> construct(final Channel channel) { // future protocol versions might have to negotiate a version or capabilities before proceeding final TransactionClientChannel clientChannel = new TransactionClientChannel(channel); channel.receiveMessage(clientChannel.getReceiver()); return new FinishedIoFuture<>(clientChannel); }
void start() { mbeanServerConnection = new TheConnection(); localNotificationManager = new LocalNotificationManager(); channel.receiveMessage(new MessageReceiver()); }
void start() throws IOException { // Create a connection ID log.debugf("Created connection - ID to be established after parameter negotiation."); // Send the welcome message. sendWelcomeMessage(); channel.receiveMessage(new MessageReciever()); }
channel.receiveMessage(this); return;
} finally { if (endReceiveLoop == false) { channel.receiveMessage(this);
public void handleMessage(final Channel channel, final MessageInputStream message) { try { channel.receiveMessage(this); final int invId; try { invId = message.readUnsignedShort(); } catch (IOException e) { // can't do much about this, but it's really unlikely anyway Log.log.inboundException(e); return; } invocationTracker.signalResponse(invId, 0, message, true); } finally { safeClose(message); } } }
public void channelOpened(final Channel channel) { final MessageTracker messageTracker = new MessageTracker(channel, channel.getOption(RemotingOptions.MAX_OUTBOUND_MESSAGES).intValue()); channel.receiveMessage(new Channel.Receiver() { public void handleError(final Channel channel, final IOException error) {
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()); } }
public void handleMessage(final Channel channel, final MessageInputStream message) { try { final int messageId = message.readUnsignedByte(); final int id = readId(message, version); final int result = message.readUnsignedByte(); if (result == Protocol.SUCCESS || result == Protocol.FAILURE) { tracker.signalResponse(id, messageId, message, true); } else { throw Messages.log.outcomeNotUnderstood(); } channel.receiveMessage(this); } catch (IOException e) { safeClose(channel); safeClose(message); } } });
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; }
channel.receiveMessage(new Channel.Receiver() { public void handleError(final Channel channel, final IOException error) { futureResult.setException(error);