boolean openInboundMessage() { int oldState, newState; do { oldState = channelState; if ((oldState & READ_CLOSED) != 0) { log.tracef("Refusing inbound message on %s (reads closed)", this); return false; } final int inboundCount = oldState & INBOUND_MESSAGES_MASK; if (inboundCount == maxInboundMessages) { log.tracef("Refusing inbound message on %s (too many concurrent reads)", this); return false; } newState = oldState + ONE_INBOUND_MESSAGE; } while (!casState(oldState, newState)); log.tracef("Opened inbound message on %s", this); return true; }
void openOutboundMessage() throws IOException { int oldState, newState; do { oldState = channelState; if ((oldState & WRITE_CLOSED) != 0) { throw new NotOpenException("Writes closed"); } final int outboundCount = oldState & OUTBOUND_MESSAGES_MASK; if (outboundCount == maxOutboundMessages) { throw new ChannelBusyException("Too many open outbound writes"); } newState = oldState + ONE_OUTBOUND_MESSAGE; } while (!casState(oldState, newState)); log.tracef("Opened outbound message on %s", this); }
boolean closeWrites() { int oldState, newState; do { oldState = channelState; if ((oldState & WRITE_CLOSED) != 0) { return false; } newState = oldState | WRITE_CLOSED; } while (!casState(oldState, newState)); if (oldState == READ_CLOSED) { // no channels and read was closed log.tracef("Closed channel writes on %s (unregistering)", this); unregister(); } else { log.tracef("Closed channel writes on %s", this); } return true; }
void closeReads() { int oldState, newState; do { oldState = channelState; if ((oldState & READ_CLOSED) != 0) { return; } newState = oldState | READ_CLOSED; } while (!casState(oldState, newState)); if (oldState == WRITE_CLOSED) { // no channels log.tracef("Closed channel reads on %s (unregistering)", this); unregister(); } else { log.tracef("Closed channel reads on %s", this); } notifyEnd(); }
} while (!casState(oldState, newState)); if ((oldState & WRITE_CLOSED) == 0) {
void openOutboundMessage() throws IOException { int oldState, newState; do { oldState = channelState; if ((oldState & WRITE_CLOSED) != 0) { throw new NotOpenException("Writes closed"); } final int outboundCount = oldState & OUTBOUND_MESSAGES_MASK; if (outboundCount == maxOutboundMessages) { throw new ChannelBusyException("Too many open outbound writes"); } newState = oldState + ONE_OUTBOUND_MESSAGE; } while (!casState(oldState, newState)); log.tracef("Opened outbound message on %s", this); }
void openOutboundMessage() throws IOException { int oldState, newState; do { oldState = channelState; if ((oldState & WRITE_CLOSED) != 0) { throw new NotOpenException("Writes closed"); } final int outboundCount = oldState & OUTBOUND_MESSAGES_MASK; if (outboundCount == maxOutboundMessages) { throw new ChannelBusyException("Too many open outbound writes"); } newState = oldState + ONE_OUTBOUND_MESSAGE; } while (!casState(oldState, newState)); log.tracef("Opened outbound message on %s", this); }
boolean openInboundMessage() { int oldState, newState; do { oldState = channelState; if ((oldState & READ_CLOSED) != 0) { log.tracef("Refusing inbound message on %s (reads closed)", this); return false; } final int inboundCount = oldState & INBOUND_MESSAGES_MASK; if (inboundCount == maxInboundMessages) { log.tracef("Refusing inbound message on %s (too many concurrent reads)", this); return false; } newState = oldState + ONE_INBOUND_MESSAGE; } while (!casState(oldState, newState)); log.tracef("Opened inbound message on %s", this); return true; }
boolean closeWrites() { int oldState, newState; do { oldState = channelState; if ((oldState & WRITE_CLOSED) != 0) { return false; } newState = oldState | WRITE_CLOSED; } while (!casState(oldState, newState)); if (oldState == READ_CLOSED) { // no channels and read was closed log.tracef("Closed channel writes on %s (unregistering)", this); unregister(); } else { log.tracef("Closed channel writes on %s", this); } return true; }
boolean closeWrites() { int oldState, newState; do { oldState = channelState; if ((oldState & WRITE_CLOSED) != 0) { return false; } newState = oldState | WRITE_CLOSED; } while (!casState(oldState, newState)); if (oldState == READ_CLOSED) { // no channels and read was closed log.tracef("Closed channel writes on %s (unregistering)", this); unregister(); } else { log.tracef("Closed channel writes on %s", this); } return true; }
boolean openInboundMessage() { int oldState, newState; do { oldState = channelState; if ((oldState & READ_CLOSED) != 0) { log.tracef("Refusing inbound message on %s (reads closed)", this); return false; } final int inboundCount = oldState & INBOUND_MESSAGES_MASK; if (inboundCount == maxInboundMessages) { log.tracef("Refusing inbound message on %s (too many concurrent reads)", this); return false; } newState = oldState + ONE_INBOUND_MESSAGE; } while (!casState(oldState, newState)); log.tracef("Opened inbound message on %s", this); return true; }
void closeReads() { int oldState, newState; do { oldState = channelState; if ((oldState & READ_CLOSED) != 0) { return; } newState = oldState | READ_CLOSED; } while (!casState(oldState, newState)); if (oldState == WRITE_CLOSED) { // no channels log.tracef("Closed channel reads on %s (unregistering)", this); unregister(); } else { log.tracef("Closed channel reads on %s", this); } notifyEnd(); }
void closeReads() { int oldState, newState; do { oldState = channelState; if ((oldState & READ_CLOSED) != 0) { return; } newState = oldState | READ_CLOSED; } while (!casState(oldState, newState)); if (oldState == WRITE_CLOSED) { // no channels log.tracef("Closed channel reads on %s (unregistering)", this); unregister(); } else { log.tracef("Closed channel reads on %s", this); } notifyEnd(); }
} while (!casState(oldState, newState)); if ((oldState & WRITE_CLOSED) == 0) {
} while (!casState(oldState, newState)); if ((oldState & WRITE_CLOSED) == 0) {