Class IPCUtil

java.lang.Object
org.apache.hadoop.hbase.ipc.IPCUtil

@Private class IPCUtil extends Object
Utility to help ipc'ing.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final org.apache.hbase.thirdparty.io.netty.util.concurrent.FastThreadLocal<org.apache.commons.lang3.mutable.MutableInt>
     
    private static final org.slf4j.Logger
     
    (package private) static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.RequestHeader
    buildRequestHeader(Call call, org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.CellBlockMeta cellBlockMeta)
     
    (package private) static org.apache.hadoop.ipc.RemoteException
    createRemoteException(org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.ExceptionResponse e)
     
    (package private) static void
    execute(org.apache.hbase.thirdparty.io.netty.channel.EventLoop eventLoop, Runnable action)
     
    private static String
    getCallTarget(Address addr, RegionInfo regionInfo)
     
    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
    (package private) static boolean
    isFatalConnectionException(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 void
     
    (package private) static IOException
     
    (package private) static IOException
    wrapException(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 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)
    Write out header, param, and cell block if there is one.
    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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
    • DEPTH

      private static final org.apache.hbase.thirdparty.io.netty.util.concurrent.FastThreadLocal<org.apache.commons.lang3.mutable.MutableInt> DEPTH
    • MAX_DEPTH

      static final int MAX_DEPTH
      See Also:
  • Constructor Details

  • 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 into
      header - to write
      param - to write
      cellBlock - 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

      private static String getCallTarget(Address addr, RegionInfo regionInfo)
    • wrapException

      static IOException wrapException(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. 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, the error is not an IOException, an IOException will be created.

      Parameters:
      addr - target address
      error - the relevant exception
      Returns:
      an exception to throw
      See Also:
    • setCancelled

      static void setCancelled(Call call)
    • execute

      static void execute(org.apache.hbase.thirdparty.io.netty.channel.EventLoop eventLoop, Runnable action)