org.apache.hadoop.hbase
Class HMsg

java.lang.Object
  extended by org.apache.hadoop.hbase.HMsg
All Implemented Interfaces:
org.apache.hadoop.io.Writable

public class HMsg
extends Object
implements org.apache.hadoop.io.Writable

HMsg is used to send messages between master and regionservers. Messages are sent as payload on the regionserver-to-master heartbeats. Region assignment does not use this mechanism. It goes via zookeeper.

Most of the time the messages are simple but some messages are accompanied by the region affected. HMsg may also carry an optional message.

TODO: Clean out all messages that go from master to regionserver; by design, these are to go via zk from here on out.


Nested Class Summary
static class HMsg.Type
           
 
Field Summary
static HMsg[] EMPTY_HMSG_ARRAY
           
static HMsg[] STOP_REGIONSERVER_ARRAY
           
 
Constructor Summary
HMsg()
          Default constructor.
HMsg(HMsg.Type type)
          Construct a message with the specified message and empty HRegionInfo
HMsg(HMsg.Type type, HRegionInfo hri)
          Construct a message with the specified message and HRegionInfo
HMsg(HMsg.Type type, HRegionInfo hri, byte[] msg)
          Construct a message with the specified message and HRegionInfo
HMsg(HMsg.Type type, HRegionInfo hri, HRegionInfo daughterA, HRegionInfo daughterB, byte[] msg)
          Construct a message with the specified message and HRegionInfo
 
Method Summary
 boolean equals(Object obj)
           
 HRegionInfo getDaughterA()
           
 HRegionInfo getDaughterB()
           
 byte[] getMessage()
           
 HRegionInfo getRegionInfo()
           
 HMsg.Type getType()
           
 int hashCode()
           
 boolean isType(HMsg.Type other)
           
 void readFields(DataInput in)
           
 String toString()
           
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

STOP_REGIONSERVER_ARRAY

public static final HMsg[] STOP_REGIONSERVER_ARRAY

EMPTY_HMSG_ARRAY

public static final HMsg[] EMPTY_HMSG_ARRAY
Constructor Detail

HMsg

public HMsg()
Default constructor. Used during deserialization


HMsg

public HMsg(HMsg.Type type)
Construct a message with the specified message and empty HRegionInfo

Parameters:
type - Message type

HMsg

public HMsg(HMsg.Type type,
            HRegionInfo hri)
Construct a message with the specified message and HRegionInfo

Parameters:
type - Message type
hri - Region to which message type applies

HMsg

public HMsg(HMsg.Type type,
            HRegionInfo hri,
            byte[] msg)
Construct a message with the specified message and HRegionInfo

Parameters:
type - Message type
hri - Region to which message type applies. Cannot be null. If no info associated, used other Constructor.
msg - Optional message (Stringified exception, etc.)

HMsg

public HMsg(HMsg.Type type,
            HRegionInfo hri,
            HRegionInfo daughterA,
            HRegionInfo daughterB,
            byte[] msg)
Construct a message with the specified message and HRegionInfo

Parameters:
type - Message type
hri - Region to which message type applies. Cannot be null. If no info associated, used other Constructor.
daughterA -
daughterB -
msg - Optional message (Stringified exception, etc.)
Method Detail

getRegionInfo

public HRegionInfo getRegionInfo()
Returns:
Region info or null if none associated with this message type.

getType

public HMsg.Type getType()
Returns:
the type of message

isType

public boolean isType(HMsg.Type other)
Parameters:
other - Message type to compare to
Returns:
True if we are of same message type as other

getMessage

public byte[] getMessage()
Returns:
the message type

getDaughterA

public HRegionInfo getDaughterA()
Returns:
First daughter if Type is MSG_REPORT_SPLIT_INCLUDES_DAUGHTERS else null

getDaughterB

public HRegionInfo getDaughterB()
Returns:
Second daughter if Type is MSG_REPORT_SPLIT_INCLUDES_DAUGHTERS else null

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException
See Also:
Writable.write(java.io.DataOutput)

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException
See Also:
Writable.readFields(java.io.DataInput)


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.