@Override public boolean isUrgent() { return isFlagRaised(FLAG_URGENT); }
/** * Returns {@code true} if any of the flags supplied in the argument are set. * * @param flagsToCheck the flags to check * @return {@code true} if any of the flags is set, {@code false} otherwise. */ public boolean isFlagRaised(int flagsToCheck) { return isFlagRaised(flags, flagsToCheck); }
@Override public boolean isUrgent() { return isFlagRaised(FLAG_URGENT); }
/** * Returns {@code true} if any of the flags supplied in the argument are set. * * @param flagsToCheck the flags to check * @return {@code true} if any of the flags is set, {@code false} otherwise. */ public boolean isFlagRaised(int flagsToCheck) { return isFlagRaised(flags, flagsToCheck); }
private void checkPayloadSize(Packet packet) { byte[] payload = packet.toByteArray(); int foundPayloadSize = payload == null ? 0 : payload.length; int expectedPayloadSize; if (packet.isFlagRaised(FLAG_OP_RESPONSE) && !returnPayload) { expectedPayloadSize = 0; } else { expectedPayloadSize = payloadSize; } if (foundPayloadSize != expectedPayloadSize) { throw new IllegalArgumentException("Unexpected payload size; expected: " + expectedPayloadSize + " but found: " + foundPayloadSize); } } }
@Override public void handle(Packet packet) throws Exception { checkPayloadSize(packet); checkPayloadContent(packet); if (packet.isFlagRaised(FLAG_OP_RESPONSE)) { handleResponse(packet); } else { handleRequest(packet); } }
protected void onPacketComplete(Packet packet) { if (packet.isFlagRaised(FLAG_URGENT)) { priorityPacketsRead.inc(); } else { normalPacketsRead.inc(); } packet.setConn(connection); dst.accept(packet); } }
protected void onPacketComplete(Packet packet) { if (packet.isFlagRaised(FLAG_URGENT)) { priorityPacketsRead.inc(); } else { normalPacketsRead.inc(); } packet.setConn(connection); dst.accept(packet); } }
void handle(Packet packet) throws IOException { if (!packet.isFlagRaised(FLAG_JET_FLOW_CONTROL)) { handleStreamPacket(packet); return; } handleFlowControlPacket(packet.getConn().getEndPoint(), packet.toByteArray()); }
switch (packet.getPacketType()) { case OPERATION: if (packet.isFlagRaised(FLAG_OP_RESPONSE)) { responseHandler.accept(packet); } else if (packet.isFlagRaised(FLAG_OP_CONTROL)) { invocationMonitor.accept(packet); } else {
switch (packet.getPacketType()) { case OPERATION: if (packet.isFlagRaised(FLAG_OP_RESPONSE)) { responseHandler.accept(packet); } else if (packet.isFlagRaised(FLAG_OP_CONTROL)) { invocationMonitor.accept(packet); } else {
checkNotNull(packet, "packet can't be null"); checkTrue(packet.getPacketType() == OPERATION, "Packet type is not OPERATION"); checkTrue(packet.isFlagRaised(FLAG_OP_RESPONSE), "FLAG_OP_RESPONSE is not set");
checkNotNull(packet, "packet can't be null"); checkTrue(packet.getPacketType() == OPERATION, "Packet type is not OPERATION"); checkTrue(packet.isFlagRaised(FLAG_OP_RESPONSE), "FLAG_OP_RESPONSE is not set");