本文整理匯總了Java中com.google.protobuf.Descriptors.MethodDescriptor方法的典型用法代碼示例。如果您正苦於以下問題:Java Descriptors.MethodDescriptor方法的具體用法?Java Descriptors.MethodDescriptor怎麽用?Java Descriptors.MethodDescriptor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.protobuf.Descriptors
的用法示例。
在下文中一共展示了Descriptors.MethodDescriptor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: callMethod
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
@Override
@InterfaceAudience.Private
public void callMethod(Descriptors.MethodDescriptor method,
RpcController controller,
Message request, Message responsePrototype,
RpcCallback<Message> callback) {
Message response = null;
try {
response = callExecService(controller, method, request, responsePrototype);
} catch (IOException ioe) {
LOG.warn("Call failed on IOException", ioe);
ResponseConverter.setControllerException(controller, ioe);
}
if (callback != null) {
callback.run(response);
}
}
示例2: callBlockingMethod
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
@Override
public Message callBlockingMethod(Descriptors.MethodDescriptor md, RpcController controller,
Message param, Message returnType) throws ServiceException {
PayloadCarryingRpcController pcrc;
if (controller != null && controller instanceof PayloadCarryingRpcController) {
pcrc = (PayloadCarryingRpcController) controller;
if (!pcrc.hasCallTimeout()) {
pcrc.setCallTimeout(channelOperationTimeout);
}
} else {
pcrc = new PayloadCarryingRpcController();
pcrc.setCallTimeout(channelOperationTimeout);
}
return this.rpcClient.callBlockingMethod(md, pcrc, param, returnType, this.ticket, this.isa);
}
示例3: AsyncCall
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
/**
* Constructor
*
* @param eventLoop for call
* @param connectId connection id
* @param md the method descriptor
* @param param parameters to send to Server
* @param controller controller for response
* @param responseDefaultType the default response type
*/
public AsyncCall(EventLoop eventLoop, int connectId, Descriptors.MethodDescriptor md, Message
param, PayloadCarryingRpcController controller, Message responseDefaultType,
MetricsConnection.CallStats callStats) {
super(eventLoop);
this.id = connectId;
this.method = md;
this.param = param;
this.controller = controller;
this.responseDefaultType = responseDefaultType;
this.startTime = EnvironmentEdgeManager.currentTime();
this.rpcTimeout = controller.hasCallTimeout() ? controller.getCallTimeout() : 0;
this.callStats = callStats;
}
示例4: callMethod
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
@Override
public void callMethod(Descriptors.MethodDescriptor md, RpcController controller,
Message param, Message returnType, RpcCallback<Message> done) {
PayloadCarryingRpcController pcrc;
if (controller != null) {
pcrc = (PayloadCarryingRpcController) controller;
if (!pcrc.hasCallTimeout()) {
pcrc.setCallTimeout(channelOperationTimeout);
}
} else {
pcrc = new PayloadCarryingRpcController();
pcrc.setCallTimeout(channelOperationTimeout);
}
this.rpcClient.callMethod(md, pcrc, param, returnType, this.ticket, this.isa, done);
}
示例5: callBlockingMethod
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
@Override
public Message callBlockingMethod(Descriptors.MethodDescriptor md, RpcController controller,
Message param, Message returnType) throws ServiceException {
PayloadCarryingRpcController pcrc;
if (controller != null) {
pcrc = (PayloadCarryingRpcController) controller;
if (!pcrc.hasCallTimeout()){
pcrc.setCallTimeout(defaultOperationTimeout);
}
} else {
pcrc = new PayloadCarryingRpcController();
pcrc.setCallTimeout(defaultOperationTimeout);
}
return this.rpcClient.callBlockingMethod(md, pcrc, param, returnType, this.ticket, this.isa);
}
示例6: callMethod
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
@Override
@InterfaceAudience.Private
public void callMethod(Descriptors.MethodDescriptor method,
RpcController controller,
Message request, Message responsePrototype,
RpcCallback<Message> callback) {
Message response = null;
try {
response = callExecService(method, request, responsePrototype);
} catch (IOException ioe) {
LOG.warn("Call failed on IOException", ioe);
ResponseConverter.setControllerException(controller, ioe);
}
if (callback != null) {
callback.run(response);
}
}
示例7: callMethod
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
public void callMethod(Descriptors.MethodDescriptor method,
RpcController controller, Message request,
Message responsePrototype, RpcCallback<Message> done) {
ProtoRpcController rpc = (ProtoRpcController) controller;
rpc.startRpc(eventLoop, responsePrototype.newBuilderForType(), done);
if (connection == null) {
// closed connection: fail the RPC
rpc.finishRpcFailure(Protocol.Status.ERROR_COMMUNICATION, "Connection closed");
return;
}
// Package up the request and send it
final boolean debug = LOG.isDebugEnabled();
synchronized (this) {
pendingRpcs.put(sequence, rpc);
// System.err.println("Sending RPC sequence " + sequence);
RpcRequest rpcRequest = makeRpcRequest(sequence, method, request);
sequence += 1;
boolean blocked = connection.tryWrite(rpcRequest);
if (blocked) {
// the write blocked: wait for write callbacks
if (debug) LOG.debug("registering write with eventLoop: " + eventLoop);
eventLoop.registerWrite(connection.getChannel(), this);
}
if (debug) LOG.debug(String.format("%d: Sending RPC %s sequence %d blocked = %b", hashCode(), method.getFullName(), sequence, blocked));
}
}
示例8: makeRpcRequest
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
public static RpcRequest makeRpcRequest(
int sequence, Descriptors.MethodDescriptor method, Message request) {
RpcRequest.Builder requestBuilder = RpcRequest.newBuilder();
requestBuilder.setSequenceNumber(sequence);
requestBuilder.setMethodName(method.getFullName());
requestBuilder.setRequest(request.toByteString());
return requestBuilder.build();
}
示例9: batchCoprocessorService
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
@Override
public <R extends Message> Map<byte[], R> batchCoprocessorService(
Descriptors.MethodDescriptor method, Message request,
byte[] startKey, byte[] endKey, R responsePrototype) throws ServiceException, Throwable {
checkState();
return table.batchCoprocessorService(method, request, startKey, endKey,
responsePrototype);
}
示例10: batchCoprocessorService
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
@Override
public <R extends Message> void batchCoprocessorService(
Descriptors.MethodDescriptor method, Message request,
byte[] startKey, byte[] endKey, R responsePrototype, Callback<R> callback)
throws ServiceException, Throwable {
throw new UnsupportedOperationException("batchCoprocessorService not implemented");
}
示例11: callBlockingMethod
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
@Override
@InterfaceAudience.Private
public Message callBlockingMethod(Descriptors.MethodDescriptor method,
RpcController controller,
Message request, Message responsePrototype)
throws ServiceException {
try {
return callExecService(controller, method, request, responsePrototype);
} catch (IOException ioe) {
throw new ServiceException("Error calling method "+method.getFullName(), ioe);
}
}
示例12: callExecService
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
@Override
protected Message callExecService(RpcController controller,
Descriptors.MethodDescriptor method, Message request, Message responsePrototype)
throws IOException {
if (LOG.isTraceEnabled()) {
LOG.trace("Call: " + method.getName() + ", " + request.toString());
}
final ClientProtos.CoprocessorServiceCall call =
ClientProtos.CoprocessorServiceCall.newBuilder()
.setRow(ByteStringer.wrap(HConstants.EMPTY_BYTE_ARRAY))
.setServiceName(method.getService().getFullName()).setMethodName(method.getName())
.setRequest(request.toByteString()).build();
// TODO: Are we retrying here? Does not seem so. We should use RetryingRpcCaller
CoprocessorServiceResponse result =
ProtobufUtil.execRegionServerService(controller, connection.getClient(serverName), call);
Message response = null;
if (result.getValue().hasValue()) {
Message.Builder builder = responsePrototype.newBuilderForType();
ProtobufUtil.mergeFrom(builder, result.getValue().getValue());
response = builder.build();
} else {
response = responsePrototype.getDefaultInstanceForType();
}
if (LOG.isTraceEnabled()) {
LOG.trace("Result is value=" + response);
}
return response;
}
示例13: Call
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
protected Call(int id, final Descriptors.MethodDescriptor md, Message param,
final CellScanner cells, final Message responseDefaultType, int timeout,
MetricsConnection.CallStats callStats) {
this.param = param;
this.md = md;
this.cells = cells;
this.callStats = callStats;
this.callStats.setStartTime(EnvironmentEdgeManager.currentTime());
this.responseDefaultType = responseDefaultType;
this.id = id;
this.timeout = timeout;
}
示例14: batchCoprocessorService
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
public <R extends Message> Map<byte[], R> batchCoprocessorService(
Descriptors.MethodDescriptor methodDescriptor, Message request,
byte[] startKey, byte[] endKey, R responsePrototype) throws ServiceException {
throw new RuntimeException(this.getClass() + " does NOT implement this method.");
}
示例15: batchCoprocessorService
import com.google.protobuf.Descriptors; //導入方法依賴的package包/類
<R extends Message> CompletableFuture<Map<byte[], R>> batchCoprocessorService(final String tableName, final Descriptors.MethodDescriptor methodDescriptor,
final Message request, final Object startRowKey, final Object endRowKey, final R responsePrototype) throws Exception {
return asyncExecutor.execute(new Callable<Map<byte[], R>>() {
@Override
public Map<byte[], R> call() throws Exception {
return hbaseExecutor.batchCoprocessorService(tableName, methodDescriptor, request, startRowKey, endRowKey, responsePrototype);
}
});
}