private <T extends NettyClientBase> T makeClient(EventLoopGroup eventLoopGroup, RpcConnectionKey rpcConnectionKey, Properties rpcParams) throws NoSuchMethodException, ClassNotFoundException, ConnectException { NettyClientBase client; if (rpcConnectionKey.asyncMode) { client = new AsyncRpcClient(eventLoopGroup, rpcConnectionKey, rpcParams); } else { client = new BlockingRpcClient(eventLoopGroup, rpcConnectionKey, rpcParams); } return (T) client; }
@Override protected void handleException(int requestId, ResponseCallback callback, String message) { RpcResponse.Builder responseBuilder = RpcResponse.newBuilder() .setErrorMessage(message + "") .setId(requestId); callback.run(responseBuilder.build()); } }
public synchronized <T extends NettyClientBase> T newBlockingClient(InetSocketAddress addr, Class<?> protocolClass, EventLoopGroup eventLoopGroup, Properties rpcParams) throws NoSuchMethodException, ClassNotFoundException, ConnectException { T client = makeClient(eventLoopGroup, new RpcConnectionKey(addr, protocolClass, false), rpcParams); client.connect(); assert client.isConnected(); return client; }
AsyncRpcClient(RpcConnectionKey rpcConnectionKey, int retries, int idleTimeSeconds) throws ClassNotFoundException, NoSuchMethodException { super(rpcConnectionKey, retries); stubMethod = getServiceClass().getMethod("newStub", RpcChannel.class); rpcChannel = new ProxyRpcChannel(); inboundHandler = new ClientChannelInboundHandler(); init(new ProtoChannelInitializer(inboundHandler, RpcResponse.getDefaultInstance(), idleTimeSeconds)); }
BlockingRpcClient(RpcConnectionKey rpcConnectionKey, int retries, int idleTimeSeconds) throws ClassNotFoundException, NoSuchMethodException { super(rpcConnectionKey, retries); stubMethod = getServiceClass().getMethod("newBlockingStub", BlockingRpcChannel.class); rpcChannel = new ProxyRpcChannel(); inboundHandler = new ClientChannelInboundHandler(); init(new ProtoChannelInitializer(inboundHandler, RpcResponse.getDefaultInstance(), idleTimeSeconds)); }
public org.apache.tajo.rpc.RpcProtos.RpcRequest build() { org.apache.tajo.rpc.RpcProtos.RpcRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
/** * <code>optional bytes response_message = 2;</code> */ public Builder clearResponseMessage() { bitField0_ = (bitField0_ & ~0x00000002); responseMessage_ = getDefaultInstance().getResponseMessage(); onChanged(); return this; }
/** * <code>optional string error_trace = 5;</code> */ public Builder clearErrorTrace() { bitField0_ = (bitField0_ & ~0x00000010); errorTrace_ = getDefaultInstance().getErrorTrace(); onChanged(); return this; } /**
/** * <code>required string method_name = 2;</code> */ public Builder clearMethodName() { bitField0_ = (bitField0_ & ~0x00000002); methodName_ = getDefaultInstance().getMethodName(); onChanged(); return this; } /**
/** * <code>optional bytes request_message = 3;</code> */ public Builder clearRequestMessage() { bitField0_ = (bitField0_ & ~0x00000004); requestMessage_ = getDefaultInstance().getRequestMessage(); onChanged(); return this; }
/** * <code>optional string error_class = 3;</code> */ public Builder clearErrorClass() { bitField0_ = (bitField0_ & ~0x00000004); errorClass_ = getDefaultInstance().getErrorClass(); onChanged(); return this; } /**
public org.apache.tajo.rpc.RpcProtos.RpcResponse build() { org.apache.tajo.rpc.RpcProtos.RpcResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
/** * Connect a {@link NettyClientBase} to the remote {@link NettyServerBase}, and returns rpc client by protocol. * This client does not managed. It should close. */ public <T extends NettyClientBase> T newClient(InetSocketAddress addr, Class<?> protocolClass, boolean asyncMode, Properties rpcParams) throws NoSuchMethodException, ClassNotFoundException, ConnectException { return newClient(new RpcConnectionKey(addr, protocolClass, asyncMode), rpcParams); }
@Override protected void handleException(int requestId, ProtoCallFuture callback, String message) { callback.setFailed(message + "", new TajoServiceException(message)); } }
@Override public void close() { sendExceptions("AsyncRpcClient terminates all the connections"); super.close(); }
@Override protected void handleException(int requestId, ResponseCallback callback, String message) { RpcResponse.Builder responseBuilder = RpcResponse.newBuilder() .setErrorMessage(message + "") .setId(requestId); callback.run(responseBuilder.build()); } }
public synchronized <T extends NettyClientBase> T newBlockingClient(InetSocketAddress addr, Class<?> protocolClass, EventLoopGroup eventLoopGroup, Properties rpcParams) throws NoSuchMethodException, ClassNotFoundException, ConnectException { T client = makeClient(eventLoopGroup, new RpcConnectionKey(addr, protocolClass, false), rpcParams); client.connect(); assert client.isConnected(); return client; }
private <T extends NettyClientBase> T makeClient(EventLoopGroup eventLoopGroup, RpcConnectionKey rpcConnectionKey, Properties rpcParams) throws NoSuchMethodException, ClassNotFoundException, ConnectException { NettyClientBase client; if (rpcConnectionKey.asyncMode) { client = new AsyncRpcClient(eventLoopGroup, rpcConnectionKey, rpcParams); } else { client = new BlockingRpcClient(eventLoopGroup, rpcConnectionKey, rpcParams); } return (T) client; }
public org.apache.tajo.rpc.RpcProtos.RpcRequest build() { org.apache.tajo.rpc.RpcProtos.RpcRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
/** * <code>optional bytes response_message = 2;</code> */ public Builder clearResponseMessage() { bitField0_ = (bitField0_ & ~0x00000002); responseMessage_ = getDefaultInstance().getResponseMessage(); onChanged(); return this; }