Package org.apache.hadoop.hbase.ipc
Class IPCUtil
java.lang.Object
org.apache.hadoop.hbase.ipc.IPCUtil
Utility to help ipc'ing.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.RequestHeaderbuildRequestHeader(Call call, org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.CellBlockMeta cellBlockMeta) (package private) static org.apache.hadoop.ipc.RemoteExceptioncreateRemoteException(org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.ExceptionResponse e) (package private) static voidprivate static StringgetCallTarget(Address addr, RegionInfo regionInfo) static intgetTotalSizeWhenWrittenDelimited(org.apache.hbase.thirdparty.com.google.protobuf.Message... messages) Returns Size on the wire when the two messages are written with writeDelimitedTo(package private) static booleanisFatalConnectionException(org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.ExceptionResponse e) Returns True if the exception is a fatal connection exception.(package private) static boolean(package private) static voidsetCancelled(Call call) (package private) static IOException(package private) static IOExceptionwrapException(Address addr, RegionInfo regionInfo, Throwable error) Takes an Exception, the address, and if pertinent, the RegionInfo for the Region we were trying to connect to and returns an IOException with the input exception as the cause.static intwrite(OutputStream dos, org.apache.hbase.thirdparty.com.google.protobuf.Message header, org.apache.hbase.thirdparty.com.google.protobuf.Message param, org.apache.hbase.thirdparty.io.netty.buffer.ByteBuf cellBlock) Write out header, param, and cell block if there is one.private static intwrite(OutputStream dos, org.apache.hbase.thirdparty.com.google.protobuf.Message header, org.apache.hbase.thirdparty.com.google.protobuf.Message param, org.apache.hbase.thirdparty.io.netty.buffer.ByteBuf cellBlock, int totalSize)
-
Field Details
-
LOG
-
DEPTH
private static final org.apache.hbase.thirdparty.io.netty.util.concurrent.FastThreadLocal<org.apache.commons.lang3.mutable.MutableInt> DEPTH -
MAX_DEPTH
- See Also:
-
-
Constructor Details
-
IPCUtil
IPCUtil()
-
-
Method Details
-
write
public static int write(OutputStream dos, org.apache.hbase.thirdparty.com.google.protobuf.Message header, org.apache.hbase.thirdparty.com.google.protobuf.Message param, org.apache.hbase.thirdparty.io.netty.buffer.ByteBuf cellBlock) throws IOException Write out header, param, and cell block if there is one.- Parameters:
dos- Stream to write intoheader- to writeparam- to writecellBlock- to write- Returns:
- Total number of bytes written.
- Throws:
IOException- if write action fails
-
write
private static int write(OutputStream dos, org.apache.hbase.thirdparty.com.google.protobuf.Message header, org.apache.hbase.thirdparty.com.google.protobuf.Message param, org.apache.hbase.thirdparty.io.netty.buffer.ByteBuf cellBlock, int totalSize) throws IOException - Throws:
IOException
-
getTotalSizeWhenWrittenDelimited
public static int getTotalSizeWhenWrittenDelimited(org.apache.hbase.thirdparty.com.google.protobuf.Message... messages) Returns Size on the wire when the two messages are written with writeDelimitedTo -
buildRequestHeader
static org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.RequestHeader buildRequestHeader(Call call, org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.CellBlockMeta cellBlockMeta) -
createRemoteException
static org.apache.hadoop.ipc.RemoteException createRemoteException(org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.ExceptionResponse e) - Parameters:
e- exception to be wrapped- Returns:
- RemoteException made from passed
e
-
isFatalConnectionException
static boolean isFatalConnectionException(org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.ExceptionResponse e) Returns True if the exception is a fatal connection exception. -
isSecurityNotEnabledException
-
toIOE
-
getCallTarget
-
wrapException
Takes an Exception, the address, and if pertinent, the RegionInfo for the Region we were trying to connect to and returns an IOException with the input exception as the cause. The new exception provides the stack trace of the place where the exception is thrown and some extra diagnostics information. Notice that we will try our best to keep the original exception type when creating a new exception, especially for the 'connection' exceptions, as it is used to determine whether this is a network issue or the remote side tells us clearly what is wrong, which is important deciding whether to retry. If it is not possible to create a new exception with the same type, for example, theerroris not anIOException, anIOExceptionwill be created.- Parameters:
addr- target addresserror- the relevant exception- Returns:
- an exception to throw
- See Also:
-
setCancelled
-
execute
-