本文整理汇总了Java中org.apache.thrift.TApplicationException.UNKNOWN_METHOD属性的典型用法代码示例。如果您正苦于以下问题:Java TApplicationException.UNKNOWN_METHOD属性的具体用法?Java TApplicationException.UNKNOWN_METHOD怎么用?Java TApplicationException.UNKNOWN_METHOD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.thrift.TApplicationException
的用法示例。
在下文中一共展示了TApplicationException.UNKNOWN_METHOD属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
@Override
public boolean process(TProtocol in, TProtocol out) throws TException {
TMessage msg = in.readMessageBegin();
Controller<?, ?> fn = (Controller<?, ?>) this.beanFactory
.getBean(msg.name);
if (fn == null) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Invalid request: failed to find interface="
+ msg.name + ", from: " + getInetAddress(in));
}
TProtocolUtil.skip(in, TType.STRUCT);
in.readMessageEnd();
TApplicationException x = new TApplicationException(
TApplicationException.UNKNOWN_METHOD,
"Invalid method name: '" + msg.name + "'");
out.writeMessageBegin(new TMessage(msg.name,
TMessageType.EXCEPTION, msg.seqid));
x.write(out);
out.writeMessageEnd();
out.getTransport().flush();
return true;
}
process(msg.seqid, msg.name, in, out, fn);
return true;
}
示例2: process
@Override
public final boolean process(final TProtocol in, final TProtocol out)
throws TException {
final TMessage msg = in.readMessageBegin();
final ProcessFunction<LocatorServiceImpl, ?> fn = this.fnMap
.get(msg.name);
if (fn != null) {
fn.process(msg.seqid, in, out, this.inst);
// terminate connection on receiving closeConnection
// direct class comparison should be the fastest way
return fn.getClass() != LocatorService.Processor.closeConnection.class;
}
else {
TProtocolUtil.skip(in, TType.STRUCT);
in.readMessageEnd();
TApplicationException x = new TApplicationException(
TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"
+ msg.name + "'");
out.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION,
msg.seqid));
x.write(out);
out.writeMessageEnd();
out.getTransport().flush();
return true;
}
}
示例3: handleTApplicationException
void handleTApplicationException(Throwable cause,
Optional<StreamOp> op,
SocketAddress addr,
ProxyClient sc) {
TApplicationException ex = (TApplicationException) cause;
if (ex.getType() == TApplicationException.UNKNOWN_METHOD) {
// if we encountered unknown method exception on thrift server, it means this proxy
// has problem. we should remove it from routing service, clean up ownerships
routingService.removeHost(addr, cause);
onServerLeft(addr, sc);
if (op.isPresent()) {
ownershipCache.removeOwnerFromStream(op.get().stream, addr, cause.getMessage());
doSend(op.get(), addr);
}
} else {
handleException(cause, op, addr);
}
}
示例4: process
@Override
public final boolean process(final TProtocol in, final TProtocol out)
throws TException {
final TMessage msg = in.readMessageBegin();
final ProcessFunction<GFXDServiceImpl, ?> fn = this.fnMap.get(msg.name);
if (fn != null) {
fn.process(msg.seqid, in, out, this.inst);
// terminate connection on receiving closeConnection
// direct class comparison should be the fastest way
// TODO: SW: also need to clean up connection artifacts in the case of
// client connection failure (ConnectionListener does get a notification
// but how to tie the socket/connectionNumber to the connectionID?)
return fn.getClass() != GFXDService.Processor.closeConnection.class;
}
else {
TProtocolUtil.skip(in, TType.STRUCT);
in.readMessageEnd();
TApplicationException x = new TApplicationException(
TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"
+ msg.name + "'");
out.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION,
msg.seqid));
x.write(out);
out.writeMessageEnd();
out.getTransport().flush();
return true;
}
}