Class MonitoredRPCHandlerImpl

java.lang.Object
org.apache.hadoop.hbase.monitoring.MonitoredTaskImpl
org.apache.hadoop.hbase.monitoring.MonitoredRPCHandlerImpl
All Implemented Interfaces:
Cloneable, MonitoredRPCHandler, MonitoredTask

@Private public class MonitoredRPCHandlerImpl extends MonitoredTaskImpl implements MonitoredRPCHandler
A MonitoredTask implementation designed for use with RPC Handlers handling frequent, short duration tasks. String concatenations and object allocations are avoided in methods that will be hit by every RPC call.
  • Field Details

  • Constructor Details

  • Method Details

    • clone

      Description copied from interface: MonitoredTask
      Public exposure of Object.clone() in order to allow clients to easily capture current state.
      Specified by:
      clone in interface MonitoredTask
      Overrides:
      clone in class MonitoredTaskImpl
      Returns:
      a copy of the object whose references will not change
    • getStatus

      public String getStatus()
      Gets the status of this handler; if it is currently servicing an RPC, this status will include the RPC information.
      Specified by:
      getStatus in interface MonitoredTask
      Overrides:
      getStatus in class MonitoredTaskImpl
      Returns:
      a String describing the current status.
    • getRPCQueueTime

      public long getRPCQueueTime()
      Accesses the queue time for the currently running RPC on the monitored Handler.
      Specified by:
      getRPCQueueTime in interface MonitoredRPCHandler
      Returns:
      the queue timestamp or -1 if there is no RPC currently running.
    • getRPCStartTime

      public long getRPCStartTime()
      Accesses the start time for the currently running RPC on the monitored Handler.
      Specified by:
      getRPCStartTime in interface MonitoredRPCHandler
      Returns:
      the start timestamp or -1 if there is no RPC currently running.
    • getRPC

      public String getRPC()
      Produces a string representation of the method currently being serviced by this Handler.
      Specified by:
      getRPC in interface MonitoredRPCHandler
      Returns:
      a string representing the method call without parameters
    • getRPC

      public String getRPC(boolean withParams)
      Produces a string representation of the method currently being serviced by this Handler.
      Specified by:
      getRPC in interface MonitoredRPCHandler
      Parameters:
      withParams - toggle inclusion of parameters in the RPC String
      Returns:
      A human-readable string representation of the method call.
    • getRPCPacketLength

      public long getRPCPacketLength()
      Produces a string representation of the method currently being serviced by this Handler.
      Specified by:
      getRPCPacketLength in interface MonitoredRPCHandler
      Returns:
      A human-readable string representation of the method call.
    • getClient

      public String getClient()
      If an RPC call is currently running, produces a String representation of the connection from which it was received.
      Specified by:
      getClient in interface MonitoredRPCHandler
      Returns:
      A human-readable string representation of the address and port of the client.
    • isRPCRunning

      public boolean isRPCRunning()
      Indicates to the client whether this task is monitoring a currently active RPC call.
      Specified by:
      isRPCRunning in interface MonitoredRPCHandler
      Returns:
      true if the monitored handler is currently servicing an RPC call.
    • isOperationRunning

      public boolean isOperationRunning()
      Indicates to the client whether this task is monitoring a currently active RPC call to a database command. (as defined by o.a.h.h.client.Operation)
      Specified by:
      isOperationRunning in interface MonitoredRPCHandler
      Returns:
      true if the monitored handler is currently servicing an RPC call to a database command.
    • setRPC

      public void setRPC(String methodName, Object[] params, long queueTime)
      Tells this instance that it is monitoring a new RPC call.
      Specified by:
      setRPC in interface MonitoredRPCHandler
      Parameters:
      methodName - The name of the method that will be called by the RPC.
      params - The parameters that will be passed to the indicated method.
    • setRPCPacket

      public void setRPCPacket(org.apache.hbase.thirdparty.com.google.protobuf.Message param)
      Gives this instance a reference to the protobuf received by the RPC, so that it can later compute its size if asked for it.
      Specified by:
      setRPCPacket in interface MonitoredRPCHandler
      Parameters:
      param - The protobuf received by the RPC for this call
    • setConnection

      public void setConnection(String clientAddress, int remotePort)
      Registers current handler client details.
      Specified by:
      setConnection in interface MonitoredRPCHandler
      Parameters:
      clientAddress - the address of the current client
      remotePort - the port from which the client connected
    • markComplete

      public void markComplete(String status)
      Specified by:
      markComplete in interface MonitoredTask
      Overrides:
      markComplete in class MonitoredTaskImpl
    • toMap

      public Map<String,Object> toMap()
      Description copied from interface: MonitoredTask
      Creates a string map of internal details for extensible exposure of monitored tasks.
      Specified by:
      toMap in interface MonitoredTask
      Overrides:
      toMap in class MonitoredTaskImpl
      Returns:
      A Map containing information for this task.
    • generateCallInfoMap

    • toString

      public String toString()
      Overrides:
      toString in class MonitoredTaskImpl