Java Code Examples for org.apache.thrift.TApplicationException#UNKNOWN_METHOD
The following examples show how to use
org.apache.thrift.TApplicationException#UNKNOWN_METHOD .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TProtobufProcessor.java From jigsaw-payment with Apache License 2.0 | 6 votes |
@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; }
Example 2
Source File: LocatorServiceImpl.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
@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; } }
Example 3
Source File: DistributedLogClientImpl.java From distributedlog with Apache License 2.0 | 6 votes |
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); } }
Example 4
Source File: DistributedLogClientImpl.java From distributedlog with Apache License 2.0 | 6 votes |
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); } }
Example 5
Source File: LocatorServiceImpl.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
@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; } }
Example 6
Source File: GFXDServiceImpl.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
@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; } }
Example 7
Source File: GFXDServiceImpl.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
@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; } }
Example 8
Source File: ThriftExceptionUtil.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
public static String getExceptionString(Throwable t) { String typeMessage = null; if (t instanceof TTransportException) { TTransportException tte = (TTransportException)t; switch (tte.getType()) { case TTransportException.ALREADY_OPEN: typeMessage = "SOCKET ALREADY OPEN"; break; case TTransportException.END_OF_FILE: typeMessage = "SOCKET END OF TRANSMISSION"; break; case TTransportException.NOT_OPEN: typeMessage = "SOCKET NOT OPEN"; break; case TTransportException.TIMED_OUT: typeMessage = "SOCKET TIMED OUT"; break; default: typeMessage = "UNKNOWN SOCKET ERROR"; break; } } else if (t instanceof TProtocolException) { TProtocolException tpe = (TProtocolException)t; switch (tpe.getType()) { case TProtocolException.BAD_VERSION: typeMessage = "BAD PROTOCOL VERSION"; break; case TProtocolException.INVALID_DATA: typeMessage = "INVALID DATA IN PROTOCOL"; break; case TProtocolException.NEGATIVE_SIZE: typeMessage = "NEGATIVE SIZE IN PROTOCOL"; break; case TProtocolException.NOT_IMPLEMENTED: typeMessage = "NOT IMPLEMENTED"; break; case TProtocolException.SIZE_LIMIT: typeMessage = "PROTOCOL SIZE LIMIT HIT"; break; default: typeMessage = "UNKNOWN PROTOCOL ERROR"; break; } } else if (t instanceof TApplicationException) { TApplicationException tae = (TApplicationException)t; switch (tae.getType()) { case TApplicationException.BAD_SEQUENCE_ID: typeMessage = "BAD SEQUENCE ID"; break; case TApplicationException.INTERNAL_ERROR: typeMessage = "INTERNAL ERROR"; break; case TApplicationException.INVALID_MESSAGE_TYPE: typeMessage = "INVALID MESSAGE TYPE"; break; case TApplicationException.MISSING_RESULT: typeMessage = "MISSING RESULT"; break; case TApplicationException.PROTOCOL_ERROR: typeMessage = "PROTOCOL ERROR"; break; case TApplicationException.UNKNOWN_METHOD: typeMessage = "UNKNOWN METHOD"; break; case TApplicationException.WRONG_METHOD_NAME: typeMessage = "WRONG METHOD NAME"; break; default: typeMessage = "UNKNOWN APPLICATION ERROR"; break; } } String message = t.getLocalizedMessage(); if (message == null || message.length() == 0) { message = t.getClass().getName(); } if (typeMessage != null) { return message + " [" + typeMessage + ']'; } else { return message; } }
Example 9
Source File: ThriftExceptionUtil.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
public static String getExceptionString(Throwable t) { String typeMessage = null; if (t instanceof TTransportException) { TTransportException tte = (TTransportException)t; switch (tte.getType()) { case TTransportException.ALREADY_OPEN: typeMessage = "SOCKET ALREADY OPEN"; break; case TTransportException.END_OF_FILE: typeMessage = "SOCKET END OF TRANSMISSION"; break; case TTransportException.NOT_OPEN: typeMessage = "SOCKET NOT OPEN"; break; case TTransportException.TIMED_OUT: typeMessage = "SOCKET TIMED OUT"; break; default: typeMessage = "UNKNOWN SOCKET ERROR"; break; } } else if (t instanceof TProtocolException) { TProtocolException tpe = (TProtocolException)t; switch (tpe.getType()) { case TProtocolException.BAD_VERSION: typeMessage = "BAD PROTOCOL VERSION"; break; case TProtocolException.INVALID_DATA: typeMessage = "INVALID DATA IN PROTOCOL"; break; case TProtocolException.NEGATIVE_SIZE: typeMessage = "NEGATIVE SIZE IN PROTOCOL"; break; case TProtocolException.NOT_IMPLEMENTED: typeMessage = "NOT IMPLEMENTED"; break; case TProtocolException.SIZE_LIMIT: typeMessage = "PROTOCOL SIZE LIMIT HIT"; break; default: typeMessage = "UNKNOWN PROTOCOL ERROR"; break; } } else if (t instanceof TApplicationException) { TApplicationException tae = (TApplicationException)t; switch (tae.getType()) { case TApplicationException.BAD_SEQUENCE_ID: typeMessage = "BAD SEQUENCE ID"; break; case TApplicationException.INTERNAL_ERROR: typeMessage = "INTERNAL ERROR"; break; case TApplicationException.INVALID_MESSAGE_TYPE: typeMessage = "INVALID MESSAGE TYPE"; break; case TApplicationException.MISSING_RESULT: typeMessage = "MISSING RESULT"; break; case TApplicationException.PROTOCOL_ERROR: typeMessage = "PROTOCOL ERROR"; break; case TApplicationException.UNKNOWN_METHOD: typeMessage = "UNKNOWN METHOD"; break; case TApplicationException.WRONG_METHOD_NAME: typeMessage = "WRONG METHOD NAME"; break; default: typeMessage = "UNKNOWN APPLICATION ERROR"; break; } } String message = t.getLocalizedMessage(); if (message == null || message.length() == 0) { message = t.getClass().getName(); } if (typeMessage != null) { return message + " [" + typeMessage + ']'; } else { return message; } }