public void receiveMessage(final Receiver handler) { synchronized (connection.getLock()) { if (inboundMessageQueue.isEmpty()) { if ((channelState & READ_CLOSED) != 0) { getExecutor().execute(() -> handler.handleEnd(RemoteConnectionChannel.this)); } else if (nextReceiver != null) { throw new IllegalStateException("Message handler already queued"); } else { nextReceiver = handler; } } else { final InboundMessage message = inboundMessageQueue.remove(); try { getExecutor().execute(() -> handler.handleMessage(RemoteConnectionChannel.this, message.messageInputStream)); } catch (Throwable t) { connection.handleException(new IOException("Fatal connection error", t)); return; } } connection.getLock().notify(); } }
private void notifyEnd() { synchronized (connection.getLock()) { if (nextReceiver != null) { final Receiver receiver = nextReceiver; nextReceiver = null; try { getExecutor().execute(() -> receiver.handleEnd(RemoteConnectionChannel.this)); } catch (Throwable t) { connection.handleException(new IOException("Fatal connection error", t)); return; } } } }
nextReceiver = null; try { getExecutor().execute(() -> receiver.handleMessage(RemoteConnectionChannel.this, inboundMessage.messageInputStream)); ok2 = true; } catch (Throwable t) {
private void notifyEnd() { synchronized (connection.getLock()) { if (nextReceiver != null) { final Receiver receiver = nextReceiver; nextReceiver = null; try { getExecutor().execute(new Runnable() { public void run() { receiver.handleEnd(RemoteConnectionChannel.this); } }); } catch (Throwable t) { connection.handleException(new IOException("Fatal connection error", t)); return; } } } }
public void receiveMessage(final Receiver handler) { synchronized (connection.getLock()) { if (inboundMessageQueue.isEmpty()) { if ((channelState & READ_CLOSED) != 0) { getExecutor().execute(new Runnable() { public void run() { handler.handleEnd(RemoteConnectionChannel.this); } }); } else if (nextReceiver != null) { throw new IllegalStateException("Message handler already queued"); } else { nextReceiver = handler; } } else { final InboundMessage message = inboundMessageQueue.remove(); try { getExecutor().execute(new Runnable() { public void run() { handler.handleMessage(RemoteConnectionChannel.this, message.messageInputStream); } }); } catch (Throwable t) { connection.handleException(new IOException("Fatal connection error", t)); return; } } connection.getLock().notify(); } }
public void receiveMessage(final Receiver handler) { synchronized (connection.getLock()) { if (inboundMessageQueue.isEmpty()) { if ((channelState & READ_CLOSED) != 0) { getExecutor().execute(() -> handler.handleEnd(RemoteConnectionChannel.this)); } else if (nextReceiver != null) { throw new IllegalStateException("Message handler already queued"); } else { nextReceiver = handler; } } else { final InboundMessage message = inboundMessageQueue.remove(); try { getExecutor().execute(() -> handler.handleMessage(RemoteConnectionChannel.this, message.messageInputStream)); } catch (Throwable t) { connection.handleException(new IOException("Fatal connection error", t)); return; } } connection.getLock().notify(); } }
private void notifyEnd() { synchronized (connection.getLock()) { if (nextReceiver != null) { final Receiver receiver = nextReceiver; nextReceiver = null; try { getExecutor().execute(() -> receiver.handleEnd(RemoteConnectionChannel.this)); } catch (Throwable t) { connection.handleException(new IOException("Fatal connection error", t)); return; } } } }
nextReceiver = null; try { getExecutor().execute(() -> receiver.handleMessage(RemoteConnectionChannel.this, inboundMessage.messageInputStream)); ok2 = true; } catch (Throwable t) {
nextReceiver = null; try { getExecutor().execute(new Runnable() { public void run() { receiver.handleMessage(RemoteConnectionChannel.this, inboundMessage.messageInputStream);