public class MemberImpl extends java.lang.Object implements Member, java.io.Externalizable
Modifier and Type | Field and Description |
---|---|
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
|
static boolean |
DO_DNS_LOOKUPS
Should a call to getName or getHostName try to do a DNS lookup?
|
protected byte[] |
domain
Domain if we want to filter based on domain.
|
protected byte[] |
host
The listen host for this member
|
protected java.lang.String |
hostname |
protected boolean |
local
The flag indicating that this member is a local member.
|
protected long |
memberAliveTime
The number of milliseconds since this member was
created, is kept track of using the start time
|
protected java.util.concurrent.atomic.AtomicInteger |
msgCount
Counter for how many broadcast messages have been sent from this member
|
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
|
protected static StringManager |
sm |
static byte[] |
TRIBES_MBR_BEGIN |
static byte[] |
TRIBES_MBR_END |
protected int |
udpPort
The udp listen port for this member
|
protected byte[] |
uniqueId
Unique session Id for this member
|
SHUTDOWN_PAYLOAD
Constructor and Description |
---|
MemberImpl()
Empty constructor for serialization
|
MemberImpl(java.lang.String host,
int port,
long aliveTime)
Construct a new member object.
|
MemberImpl(java.lang.String host,
int port,
long aliveTime,
byte[] payload) |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
bToS(byte[] data) |
static java.lang.String |
bToS(byte[] data,
int max) |
boolean |
equals(java.lang.Object o)
Returns true if the param o is a McastMember with the same name
|
byte[] |
getCommand()
returns the command associated with this member
|
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)
Highly optimized version of serializing a member into a byte array
Returns a cached byte[] reference, do not modify this data
|
int |
getDataLength()
Length of a message obtained by
Member.getData(boolean) or
Member.getData(boolean, boolean) . |
byte[] |
getDomain()
Domain for this cluster
|
byte[] |
getHost()
Return the TCP listen host for this member
|
java.lang.String |
getHostname() |
static Member |
getMember(byte[] data) |
static Member |
getMember(byte[] data,
int offset,
int length) |
static Member |
getMember(byte[] data,
int offset,
int length,
MemberImpl member) |
static Member |
getMember(byte[] data,
MemberImpl member)
Deserializes a member from data sent over the wire.
|
long |
getMemberAliveTime()
Contains information on how long this member has been online.
|
int |
getMsgCount() |
java.lang.String |
getName()
Return the name of this object
|
byte[] |
getPayload()
returns the payload associated with this member
|
int |
getPort()
Return the listen port of this member
|
int |
getSecurePort()
Returns the secure listen port for the ChannelReceiver implementation.
|
long |
getServiceStartTime() |
int |
getUdpPort()
Returns the UDP port that this member is listening to for UDP messages.
|
byte[] |
getUniqueId()
returns a UUID unique for this member over all sessions.
|
int |
hashCode() |
protected void |
inc()
Increment the message count.
|
boolean |
isFailing() |
boolean |
isLocal() |
boolean |
isReady()
The current state of the member
|
boolean |
isSuspect()
The current state of the member
|
void |
readExternal(java.io.ObjectInput in) |
void |
setCommand(byte[] command) |
void |
setDomain(byte[] domain) |
void |
setHost(byte[] host) |
void |
setHostname(java.lang.String host) |
void |
setLocal(boolean local) |
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 |
setUdpPort(int port) |
void |
setUniqueId(byte[] uniqueId) |
java.lang.String |
toString()
String representation of this object
|
void |
writeExternal(java.io.ObjectOutput out) |
public static final boolean DO_DNS_LOOKUPS
public static final transient byte[] TRIBES_MBR_BEGIN
public static final transient byte[] TRIBES_MBR_END
protected static final StringManager sm
protected volatile byte[] host
protected transient volatile java.lang.String hostname
protected volatile int port
protected volatile int udpPort
protected volatile int securePort
protected java.util.concurrent.atomic.AtomicInteger msgCount
protected volatile long memberAliveTime
protected transient long serviceStartTime
protected transient byte[] dataPkg
protected volatile byte[] uniqueId
protected volatile byte[] payload
protected volatile byte[] command
protected volatile byte[] domain
protected volatile boolean local
public MemberImpl()
public MemberImpl(java.lang.String host, int port, long aliveTime) throws java.io.IOException
host
- - the tcp listen hostport
- - the tcp listen portaliveTime
- - the number of milliseconds since this member was createdjava.io.IOException
- If there is an error converting the host name to an
IP addresspublic MemberImpl(java.lang.String host, int port, long aliveTime, byte[] payload) throws java.io.IOException
java.io.IOException
public boolean isReady()
Member
public boolean isSuspect()
Member
public boolean isFailing()
protected void inc()
public byte[] getData()
public byte[] getData(boolean getalive)
Member
public int getDataLength()
Member
Member.getData(boolean)
or
Member.getData(boolean, boolean)
.getDataLength
in interface Member
public byte[] getData(boolean getalive, boolean reset)
Member
public static Member getMember(byte[] data, MemberImpl member)
data
- The bytes receivedmember
- The member object to populatepublic static Member getMember(byte[] data, int offset, int length, MemberImpl member)
public static Member getMember(byte[] data)
public static Member getMember(byte[] data, int offset, int length)
public java.lang.String getName()
public int getPort()
getPort
in interface Member
ChannelReceiver
public byte[] getHost()
getHost
in interface Member
ChannelReceiver
public java.lang.String getHostname()
public int getMsgCount()
public long getMemberAliveTime()
getMemberAliveTime
in interface Member
public long getServiceStartTime()
public byte[] getUniqueId()
Member
getUniqueId
in interface Member
public byte[] getPayload()
Member
getPayload
in interface Member
public byte[] getCommand()
Member
getCommand
in interface Member
public byte[] getDomain()
Member
public int getSecurePort()
Member
getSecurePort
in interface Member
ChannelReceiver
public int getUdpPort()
Member
getUdpPort
in interface Member
public void setMemberAliveTime(long time)
setMemberAliveTime
in interface Member
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String bToS(byte[] data)
public static java.lang.String bToS(byte[] data, int max)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- The object to test for equalitypublic void setHost(byte[] host)
public void setHostname(java.lang.String host) throws java.io.IOException
java.io.IOException
public void setMsgCount(int msgCount)
public void setPort(int port)
public void setServiceStartTime(long serviceStartTime)
public void setUniqueId(byte[] uniqueId)
public void setPayload(byte[] payload)
setPayload
in interface Member
public void setCommand(byte[] command)
setCommand
in interface Member
public void setDomain(byte[] domain)
public void setSecurePort(int securePort)
public void setUdpPort(int port)
public boolean isLocal()
public void setLocal(boolean local)
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.