public void writeTo(com.dyuproject.protostuff.Output output, org.apache.drill.exec.proto.BitControl.CustomMessage message) throws java.io.IOException { if(message.hasType()) output.writeInt32(1, message.getType(), false); if(message.hasMessage()) output.writeByteArray(2, message.getMessage().toByteArray(), false); } public boolean isInitialized(org.apache.drill.exec.proto.BitControl.CustomMessage message)
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, type_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, message_); } getUnknownFields().writeTo(output); }
com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable();
com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable();
public Response handle(CustomMessage message, DrillBuf dBody) throws RpcException { final ParsingHandler<?, ?> handler; try (@SuppressWarnings("unused") Closeable lock = read.open()) { handler = handlers.get(message.getType()); } if (handler == null) { throw new UserRpcException( endpoint, "Unable to handle message.", new IllegalStateException(String.format( "Unable to handle message. The message type provided [%d] did not have a registered handler.", message.getType()))); } final CustomResponse<?> customResponse = handler.onMessage(message.getMessage(), dBody); @SuppressWarnings("unchecked") final CustomMessage responseMessage = CustomMessage.newBuilder() .setMessage( ByteString.copyFrom(((Controller.CustomSerDe<Object>) handler.getResponseSerDe()) .serializeToSend(customResponse .getMessage()))) .setType(message.getType()) .build(); // make sure we don't pass in a null array. final ByteBuf[] dBodies = customResponse.getBodies() == null ? new DrillBuf[0] : customResponse.getBodies(); return new Response(RpcType.RESP_CUSTOM, responseMessage, dBodies); }
public static MessageLite getResponseDefaultInstance(int rpcType) throws RpcException { switch (rpcType) { case RpcType.ACK_VALUE: return Ack.getDefaultInstance(); case RpcType.HANDSHAKE_VALUE: return BitControlHandshake.getDefaultInstance(); case RpcType.RESP_FRAGMENT_HANDLE_VALUE: return FragmentHandle.getDefaultInstance(); case RpcType.RESP_FRAGMENT_STATUS_VALUE: return FragmentStatus.getDefaultInstance(); case RpcType.RESP_BIT_STATUS_VALUE: return BitStatus.getDefaultInstance(); case RpcType.RESP_QUERY_STATUS_VALUE: return QueryProfile.getDefaultInstance(); case RpcType.RESP_CUSTOM_VALUE: return CustomMessage.getDefaultInstance(); case RpcType.SASL_MESSAGE_VALUE: return SaslMessage.getDefaultInstance(); default: throw new UnsupportedOperationException(); } } }
/** * Send a message and receive a future for monitoring the outcome. * @param messageToSend * The structured message to send. * @param dataBodies * One or more optional unstructured messages to append to the structure message. * @return The CustomFuture that can be used to wait for the response. */ public CustomFuture<RECEIVE> send(SEND messageToSend, ByteBuf... dataBodies) { final CustomMessage customMessage = CustomMessage.newBuilder() .setMessage(ByteString.copyFrom(send.serializeToSend(messageToSend))) .setType(messageTypeId) .build(); final SyncCustomMessageSender b = new SyncCustomMessageSender(customMessage, dataBodies); manager.runCommand(b); DrillRpcFuture<CustomMessage> innerFuture = b.getFuture(); return new CustomFuture<RECEIVE>(receive, innerFuture); }
public Builder toBuilder() { return newBuilder(this); }
public org.apache.drill.exec.proto.BitControl.CustomMessage buildPartial() { org.apache.drill.exec.proto.BitControl.CustomMessage result = new org.apache.drill.exec.proto.BitControl.CustomMessage(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.type_ = type_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.message_ = message_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
/** * Send a message using a custom listener. * @param listener * The listener to inform of the outcome of the sent message. * @param messageToSend * The structured message to send. * @param dataBodies * One or more optional unstructured messages to append to the structure message. */ public void send(RpcOutcomeListener<RECEIVE> listener, SEND messageToSend, ByteBuf... dataBodies) { final CustomMessage customMessage = CustomMessage.newBuilder() .setMessage(ByteString.copyFrom(send.serializeToSend(messageToSend))) .setType(messageTypeId) .build(); manager.runCommand(new CustomMessageSender(new CustomTunnelListener(listener), customMessage, dataBodies)); }
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, type_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, message_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.apache.drill.exec.proto.BitControl.CustomMessage prototype) {
public org.apache.drill.exec.proto.BitControl.CustomMessage getDefaultInstanceForType() { return org.apache.drill.exec.proto.BitControl.CustomMessage.getDefaultInstance(); }
public static Builder newBuilder(org.apache.drill.exec.proto.BitControl.CustomMessage prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }
public RECEIVE get() throws Exception { CustomMessage message = future.checkedGet(); return serde.deserializeReceived(message.getMessage().toByteArray()); }
public RECEIVE get(long timeout, TimeUnit unit) throws Exception, InvalidProtocolBufferException { CustomMessage message = future.checkedGet(timeout, unit); return serde.deserializeReceived(message.getMessage().toByteArray()); }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, type_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, message_); } getUnknownFields().writeTo(output); }
public void writeTo(com.dyuproject.protostuff.Output output, org.apache.drill.exec.proto.BitControl.CustomMessage message) throws java.io.IOException { if(message.hasType()) output.writeInt32(1, message.getType(), false); if(message.hasMessage()) output.writeByteArray(2, message.getMessage().toByteArray(), false); } public boolean isInitialized(org.apache.drill.exec.proto.BitControl.CustomMessage message)
/** * <code>optional bytes message = 2;</code> */ public Builder clearMessage() { bitField0_ = (bitField0_ & ~0x00000002); message_ = getDefaultInstance().getMessage(); onChanged(); return this; }
public org.apache.drill.exec.proto.BitControl.CustomMessage.Builder newMessage() { return org.apache.drill.exec.proto.BitControl.CustomMessage.newBuilder(); } public java.lang.String getFieldName(int number)