MemberImpl (Apache Tomcat 6.0.53 API Documentation)
Keywords: org.apache.catalina.tribes.membership.MemberImpl class

Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache Tomcat 6.0.53
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.catalina.tribes.membership
Class MemberImpl

    java.lang.Object
      org.apache.catalina.tribes.membership.MemberImpl

All Implemented Interfaces:
  java.io.Externalizable, java.io.Serializable, Member

Direct Known Subclasses:
  StaticMember

    public class MemberImpl

extends java.lang.Object
implements Member, java.io.Externalizable

A membership implementation using simple multicast. This is the representation of a multicast member. Carries the host, and port of the this or other cluster nodes.

Author:
  Filip Hanik
See Also:
  Serialized Form

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
`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`
`static java.lang.String` | `MEMBER_NAME`
`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
`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 java.lang.String` | `TCP_LISTEN_HOST`
`static java.lang.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

Fields inherited from interface org.apache.catalina.tribes.Member
`SHUTDOWN_PAYLOAD`

Constructor Summary
`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)`

Method Summary
`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)`
`int` | `getDataLength()`
`byte[]` | `getDomain()` Domain for this cluster
`byte[]` | `getHost()` Return the TCP listen host for this member
`java.lang.String` | `getHostname()`
`static MemberImpl` | `getMember(byte[] data)`
`static MemberImpl` | `getMember(byte[] data, int offset, int length)`
`static MemberImpl` | `getMember(byte[] data, int offset, int length, MemberImpl member)`
`static MemberImpl` | `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.
`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()`
`byte[]` | `getUniqueId()` returns a UUID unique for this member over all sessions.
`int` | `hashCode()`
`protected void` | `inc()` Increment the message count.
`boolean` | `isFailing()`
`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` | `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)`
`java.lang.String` | `toString()` String representation of this object
`void` | `writeExternal(java.io.ObjectOutput out)`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### DO_DNS_LOOKUPS

    public static final boolean DO_DNS_LOOKUPS

  Should a call to getName or getHostName try to do a DNS lookup? default is false

### TCP_LISTEN_PORT

    public static final transient java.lang.String TCP_LISTEN_PORT

  Public properties specific to this implementation

  See Also:
    Constant Field Values

### TCP_LISTEN_HOST

    public static final transient java.lang.String TCP_LISTEN_HOST

See Also:
  Constant Field Values

### MEMBER_NAME

    public static final transient java.lang.String MEMBER_NAME

See Also:
  Constant Field Values

### TRIBES_MBR_BEGIN

    public static final transient byte[] TRIBES_MBR_BEGIN

### TRIBES_MBR_END

    public static final transient byte[] TRIBES_MBR_END

### host

    protected byte[] host

  The listen host for this member

### hostname

    protected transient java.lang.String hostname

### port

    protected int port

  The tcp listen port for this member

### securePort

    protected int securePort

  The tcp/SSL listen port for this member

### msgCount

    protected int msgCount

  Counter for how many broadcast messages have been sent from this member

### memberAliveTime

    protected long memberAliveTime

  The number of milliseconds since this members was created, is kept track of using the start time

### serviceStartTime

    protected transient long serviceStartTime

  For the local member only

### dataPkg

    protected transient byte[] dataPkg

  To avoid serialization over and over again, once the local dataPkg has been set, we use that to transmit data

### uniqueId

    protected byte[] uniqueId

  Unique session Id for this member

### payload

    protected byte[] payload

  Custom payload that an app framework can broadcast Also used to transport stop command.

### command

    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

### domain

    protected byte[] domain

  Domain if we want to filter based on domain.

Constructor Detail

### MemberImpl

    public MemberImpl()

  Empty constructor for serialization

### MemberImpl

    public MemberImpl(java.lang.String host,
                      int port,
                      long aliveTime)
               throws java.io.IOException

  Construct a new member object

  Parameters:
    `host` - - the tcp listen host
    `port` - - the tcp listen port
  Throws:
    `java.io.IOException`

### MemberImpl

    public MemberImpl(java.lang.String host,
                      int port,
                      long aliveTime,
                      byte[] payload)
               throws java.io.IOException

Throws:
  `java.io.IOException`

Method Detail

### isReady

    public boolean isReady()

  Description copied from interface: `Member`
  The current state of the member

  Specified by:
    `isReady` in interface `Member`
  Returns:
    boolean - true if the member is functioning correctly

### isSuspect

    public boolean isSuspect()

  Description copied from interface: `Member`
  The current state of the member

  Specified by:
    `isSuspect` in interface `Member`
  Returns:
    boolean - true if the member is suspect, but the crash has not been confirmed

### isFailing

    public boolean isFailing()

  Specified by:
    `isFailing` in interface `Member`
  Returns:
    boolean - true if the member has been confirmed to malfunction

### inc

    protected void inc()

  Increment the message count.

### getData

    public byte[] getData()

  Create a data package to send over the wire representing this member. This is faster than serialization.

  Returns:
    - the bytes for this member deserialized
  Throws:
    `java.lang.Exception`

### getData

    public 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

  Parameters:
    `getalive` - boolean
  Returns:
    byte[]

### getDataLength

    public int getDataLength()

### getData

    public byte[] getData(boolean getalive,
                          boolean reset)

  Parameters:
    `getalive` - boolean - calculate memberAlive time
    `reset` - boolean - reset the cached data package, and create a new one
  Returns:
    byte[]

### getMember

    public static MemberImpl getMember(byte[] data,
                                       MemberImpl member)

  Deserializes a member from data sent over the wire

  Parameters:
    `data` - - the bytes received
  Returns:
    a member object.

### getMember

    public static MemberImpl getMember(byte[] data,
                                       int offset,
                                       int length,
                                       MemberImpl member)

### getMember

    public static MemberImpl getMember(byte[] data)

### getMember

    public static MemberImpl getMember(byte[] data,
                                       int offset,
                                       int length)

### getName

    public java.lang.String getName()

  Return the name of this object

  Specified by:
    `getName` in interface `Member`
  Returns:
    a unique name to the cluster

### getPort

    public int getPort()

  Return the listen port of this member

  Specified by:
    `getPort` in interface `Member`
  Returns:
    - tcp listen port
  See Also:
    `ChannelReceiver`

### getHost

    public byte[] getHost()

  Return the TCP listen host for this member

  Specified by:
    `getHost` in interface `Member`
  Returns:
    IP address or host name
  See Also:
    `ChannelReceiver`

### getHostname

    public java.lang.String getHostname()

### getMemberAliveTime

    public long getMemberAliveTime()

  Contains information on how long this member has been online. The result is the number of milli seconds this member has been broadcasting its membership to the cluster.

  Specified by:
    `getMemberAliveTime` in interface `Member`
  Returns:
    nr of milliseconds since this member started.

### getServiceStartTime

    public long getServiceStartTime()

### getUniqueId

    public byte[] getUniqueId()

  Description copied from interface: `Member`
  returns a UUID unique for this member over all sessions. If the member crashes and restarts, the uniqueId will be different.

  Specified by:
    `getUniqueId` in interface `Member`
  Returns:
    byte[]

### getPayload

    public byte[] getPayload()

  Description copied from interface: `Member`
  returns the payload associated with this member

  Specified by:
    `getPayload` in interface `Member`
  Returns:
    byte[]

### getCommand

    public byte[] getCommand()

  Description copied from interface: `Member`
  returns the command associated with this member

  Specified by:
    `getCommand` in interface `Member`
  Returns:
    byte[]

### getDomain

    public byte[] getDomain()

  Description copied from interface: `Member`
  Domain for this cluster

  Specified by:
    `getDomain` in interface `Member`
  Returns:
    byte[]

### getSecurePort

    public int getSecurePort()

  Description copied from interface: `Member`
  Returns the secure listen port for the ChannelReceiver implementation. Returns -1 if its not listening to a secure port.

  Specified by:
    `getSecurePort` in interface `Member`
  Returns:
    the listen port for this member, -1 if its not listening on a secure port
  See Also:
    `ChannelReceiver`

### setMemberAliveTime

    public void setMemberAliveTime(long time)

### toString

    public java.lang.String toString()

  String representation of this object

  Overrides:
    `toString` in class `java.lang.Object`

### bToS

    public static java.lang.String bToS(byte[] data)

### bToS

    public static java.lang.String bToS(byte[] data,
                                        int max)

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    The hash code
  See Also:
    `Object.hashCode()`

### equals

    public boolean equals(java.lang.Object o)

  Returns true if the param o is a McastMember with the same name

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `o` -

### setHost

    public void setHost(byte[] host)

### setHostname

    public void setHostname(java.lang.String host)
                     throws java.io.IOException

  Throws:
    `java.io.IOException`

### setMsgCount

    public void setMsgCount(int msgCount)

### setPort

    public void setPort(int port)

### setServiceStartTime

    public void setServiceStartTime(long serviceStartTime)

### setUniqueId

    public void setUniqueId(byte[] uniqueId)

### setPayload

    public void setPayload(byte[] payload)

### setCommand

    public void setCommand(byte[] command)

### setDomain

    public void setDomain(byte[] domain)

### setSecurePort

    public void setSecurePort(int securePort)

### readExternal

    public void readExternal(java.io.ObjectInput in)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException

  Specified by:
    `readExternal` in interface `java.io.Externalizable`
  Throws:
    `java.io.IOException`
    `java.lang.ClassNotFoundException`

### writeExternal

    public void writeExternal(java.io.ObjectOutput out)
                       throws java.io.IOException

  Specified by:
    `writeExternal` in interface `java.io.Externalizable`
  Throws:
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache Tomcat 6.0.53
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.