Package org.apache.accumulo.server.rpc
Class RpcWrapper
- java.lang.Object
-
- org.apache.accumulo.server.rpc.RpcWrapper
-
public class RpcWrapper extends Object
This class accommodates the changes in THRIFT-1805, which appeared in Thrift 0.9.1 and restricts client-side notification of server-side errors toTException
only, by wrappingRuntimeException
andError
asTException
, so it doesn't just close the connection and look like a network issue, but informs the client that aTApplicationException
had occurred, as it did in Thrift 0.9.0. This performs similar functions asTraceWrap
, but with the additional action of translating exceptions. See also ACCUMULO-1691 and ACCUMULO-2950. ACCUMULO-4065 found that the above exception-wrapping is not appropriate for Thrift's implementation of oneway methods. Oneway methods are defined as a method which the client does not wait for it to return. Normally, this is acceptable as these methods are void. Therefore, if another client reuses the connection to send a new RPC, there is no "extra" data sitting on the InputStream from the Socket (that the server sent). However, the implementation of a oneway method does send a response to the client when the implementation throws aTException
. This message showing up on the client's InputStream causes future use of the Thrift Connection to become unusable. As long as the Thrift implementation sends a message back when oneway methods throw aTException
, we much make sure that we don't re-wrap-and-throw any exceptions asTException
s.- Since:
- 1.6.1
-
-
Constructor Summary
Constructors Constructor Description RpcWrapper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static <T> RpcServerInvocationHandler<T>
getInvocationHandler(T instance, Set<String> onewayMethods)
protected static Set<String>
getOnewayMethods(Map<String,?> processorView)
static <I> I
service(I instance, org.apache.thrift.TBaseProcessor<I> processor)
-
-
-
Method Detail
-
service
public static <I> I service(I instance, org.apache.thrift.TBaseProcessor<I> processor)
-
getInvocationHandler
protected static <T> RpcServerInvocationHandler<T> getInvocationHandler(T instance, Set<String> onewayMethods)
-
-