org.apache.catalina.tribes.membership
public class MemberImpl extends Object implements Member, Externalizable
Version: $Revision: 892521 $, $Date: 2009-12-19 23:56:24 +0100 (Sat, 19 Dec 2009) $
Field Summary | |
---|---|
protected byte[] | command
Command, so that the custom payload doesn't have to be used
This is for internal tribes use, such as SHUTDOWN_COMMAND |
protected byte[] | dataPkg
To avoid serialization over and over again, once the local dataPkg
has been set, we use that to transmit data |
protected byte[] | domain
Domain if we want to filter based on domain. |
static boolean | DO_DNS_LOOKUPS
Should a call to getName or getHostName try to do a DNS lookup?
|
protected byte[] | host
The listen host for this member |
protected String | hostname |
protected long | memberAliveTime
The number of milliseconds since this members was
created, is kept track of using the start time |
protected int | msgCount
Counter for how many broadcast messages have been sent from this member |
static String | MEMBER_NAME |
protected byte[] | payload
Custom payload that an app framework can broadcast
Also used to transport stop command. |
protected int | port
The tcp listen port for this member |
protected int | securePort
The tcp/SSL listen port for this member |
protected long | serviceStartTime
For the local member only |
static String | TCP_LISTEN_HOST |
static String | TCP_LISTEN_PORT
Public properties specific to this implementation |
static byte[] | TRIBES_MBR_BEGIN |
static byte[] | TRIBES_MBR_END |
protected byte[] | uniqueId
Unique session Id for this member |
Constructor Summary | |
---|---|
MemberImpl()
Empty constructor for serialization | |
MemberImpl(String host, int port, long aliveTime)
Construct a new member object | |
MemberImpl(String host, int port, long aliveTime, byte[] payload) |
Method Summary | |
---|---|
static String | bToS(byte[] data) |
static String | bToS(byte[] data, int max) |
boolean | equals(Object o)
Returns true if the param o is a McastMember with the same name |
byte[] | getCommand() |
byte[] | getData()
Create a data package to send over the wire representing this member.
|
byte[] | getData(boolean getalive)
Highly optimized version of serializing a member into a byte array
Returns a cached byte[] reference, do not modify this data |
byte[] | getData(boolean getalive, boolean reset) |
int | getDataLength() |
byte[] | getDomain() |
byte[] | getHost()
Return the TCP listen host for this member |
String | getHostname() |
static MemberImpl | getMember(byte[] data, MemberImpl member)
Deserializes a member from data sent over the wire |
static MemberImpl | getMember(byte[] data, int offset, int length, MemberImpl member) |
static MemberImpl | getMember(byte[] data) |
static MemberImpl | getMember(byte[] data, int offset, int length) |
long | getMemberAliveTime()
Contains information on how long this member has been online.
|
String | getName()
Return the name of this object |
byte[] | getPayload() |
int | getPort()
Return the listen port of this member |
int | getSecurePort() |
long | getServiceStartTime() |
byte[] | getUniqueId() |
int | hashCode() |
protected void | inc()
Increment the message count. |
boolean | isFailing() |
boolean | isReady() |
boolean | isSuspect() |
void | readExternal(ObjectInput in) |
void | setCommand(byte[] command) |
void | setDomain(byte[] domain) |
void | setHost(byte[] host) |
void | setHostname(String host) |
void | setMemberAliveTime(long time) |
void | setMsgCount(int msgCount) |
void | setPayload(byte[] payload) |
void | setPort(int port) |
void | setSecurePort(int securePort) |
void | setServiceStartTime(long serviceStartTime) |
void | setUniqueId(byte[] uniqueId) |
String | toString()
String representation of this object |
void | writeExternal(ObjectOutput out) |
Parameters: name - the name of this member, cluster unique domain - the cluster domain name of this member host - the tcp listen host port - the tcp listen port
Parameters: o
Returns: - the bytes for this member deserialized
Throws: Exception
Parameters: getalive boolean
Returns: byte[]
Parameters: getalive boolean - calculate memberAlive time reset boolean - reset the cached data package, and create a new one
Returns: byte[]
Returns: IP address or host name
Parameters: data - the bytes received
Returns: a member object.
Returns: nr of milliseconds since this member started.
Returns: a unique name to the cluster
Returns: - tcp listen port
Returns: The hash code
See Also: java.lang.Object#hashCode()