Package org.apache.catalina.tribes.tipis
Class AbstractReplicatedMap.MapMessage
- java.lang.Object
-
- org.apache.catalina.tribes.tipis.AbstractReplicatedMap.MapMessage
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
- Enclosing class:
- AbstractReplicatedMap<K,V>
public static class AbstractReplicatedMap.MapMessage extends java.lang.Object implements java.io.Serializable, java.lang.CloneableRepresents a message sent between replicated map instances.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intMSG_ACCESSMessage type: access.static intMSG_BACKUPMessage type: backup.static intMSG_COPYMessage type: copy.static intMSG_INITMessage type: init.static intMSG_NOTIFY_MAPMEMBERMessage type: notify map member.static intMSG_PINGMessage type: ping.static intMSG_PROXYMessage type: proxy.static intMSG_REMOVEMessage type: remove.static intMSG_RETRIEVE_BACKUPMessage type: retrieve backup.static intMSG_STARTMessage type: start.static intMSG_STATEMessage type: state.static intMSG_STATE_COPYMessage type: state copy.static intMSG_STOPMessage type: stop.
-
Constructor Summary
Constructors Constructor Description MapMessage(byte[] mapId, int msgtype, boolean diff, java.io.Serializable key, java.io.Serializable value, byte[] diffvalue, Member primary, Member[] nodes)Creates a new map message with the specified parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbstractReplicatedMap.MapMessageclone()Creates a shallow copy of this map message.voiddeserialize(java.lang.ClassLoader[] cls)Deserializes the key and value using the given class loaders.Member[]getBackupNodes()Gets the backup nodes.byte[]getDiffValue()Gets the diff value data.java.io.SerializablegetKey()Gets the key for this message.byte[]getKeyData()Gets the serialized key data.byte[]getMapId()Gets the map identifier.intgetMsgType()Gets the message type.MembergetPrimary()Gets the primary member.java.lang.StringgetTypeDesc()Gets a description of the message type.java.io.SerializablegetValue()Gets the value for this message.byte[]getValueData()Gets the serialized value data.booleanisDiff()Checks if this is a diff message.java.io.Serializablekey(java.lang.ClassLoader[] cls)Deserializes the key using the given class loaders.voidsetKey(java.io.Serializable key)Sets the key for this message.voidsetValue(java.io.Serializable value)Sets the value for this message.java.lang.StringtoString()Returns a string representation of this map message.java.io.Serializablevalue(java.lang.ClassLoader[] cls)Deserializes the value using the given class loaders.
-
-
-
Field Detail
-
MSG_BACKUP
public static final int MSG_BACKUP
Message type: backup.- See Also:
- Constant Field Values
-
MSG_RETRIEVE_BACKUP
public static final int MSG_RETRIEVE_BACKUP
Message type: retrieve backup.- See Also:
- Constant Field Values
-
MSG_PROXY
public static final int MSG_PROXY
Message type: proxy.- See Also:
- Constant Field Values
-
MSG_REMOVE
public static final int MSG_REMOVE
Message type: remove.- See Also:
- Constant Field Values
-
MSG_STATE
public static final int MSG_STATE
Message type: state.- See Also:
- Constant Field Values
-
MSG_START
public static final int MSG_START
Message type: start.- See Also:
- Constant Field Values
-
MSG_STOP
public static final int MSG_STOP
Message type: stop.- See Also:
- Constant Field Values
-
MSG_INIT
public static final int MSG_INIT
Message type: init.- See Also:
- Constant Field Values
-
MSG_COPY
public static final int MSG_COPY
Message type: copy.- See Also:
- Constant Field Values
-
MSG_STATE_COPY
public static final int MSG_STATE_COPY
Message type: state copy.- See Also:
- Constant Field Values
-
MSG_ACCESS
public static final int MSG_ACCESS
Message type: access.- See Also:
- Constant Field Values
-
MSG_NOTIFY_MAPMEMBER
public static final int MSG_NOTIFY_MAPMEMBER
Message type: notify map member.- See Also:
- Constant Field Values
-
MSG_PING
public static final int MSG_PING
Message type: ping.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MapMessage
public MapMessage(byte[] mapId, int msgtype, boolean diff, java.io.Serializable key, java.io.Serializable value, byte[] diffvalue, Member primary, Member[] nodes)Creates a new map message with the specified parameters.- Parameters:
mapId- The map identifiermsgtype- The message typediff- Whether this is a diff messagekey- The keyvalue- The valuediffvalue- The serialized diff valueprimary- The primary membernodes- The backup nodes
-
-
Method Detail
-
toString
public java.lang.String toString()
Returns a string representation of this map message.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of this map message
-
getTypeDesc
public java.lang.String getTypeDesc()
Gets a description of the message type.- Returns:
- A string description of the message type
-
deserialize
public void deserialize(java.lang.ClassLoader[] cls) throws java.io.IOException, java.lang.ClassNotFoundExceptionDeserializes the key and value using the given class loaders.- Parameters:
cls- The class loaders to use for deserialization- Throws:
java.io.IOException- If deserialization failsjava.lang.ClassNotFoundException- If a class is not found
-
getMsgType
public int getMsgType()
Gets the message type.- Returns:
- the message type
-
isDiff
public boolean isDiff()
Checks if this is a diff message.- Returns:
trueif this is a diff message
-
getKey
public java.io.Serializable getKey()
Gets the key for this message.- Returns:
- The key
-
key
public java.io.Serializable key(java.lang.ClassLoader[] cls) throws java.io.IOException, java.lang.ClassNotFoundExceptionDeserializes the key using the given class loaders.- Parameters:
cls- The class loaders to use for deserialization- Returns:
- The deserialized key
- Throws:
java.io.IOException- If deserialization failsjava.lang.ClassNotFoundException- If the key class is not found
-
getKeyData
public byte[] getKeyData()
Gets the serialized key data.- Returns:
- The serialized key data
-
getValue
public java.io.Serializable getValue()
Gets the value for this message.- Returns:
- The value
-
value
public java.io.Serializable value(java.lang.ClassLoader[] cls) throws java.io.IOException, java.lang.ClassNotFoundExceptionDeserializes the value using the given class loaders.- Parameters:
cls- The class loaders to use for deserialization- Returns:
- The deserialized value
- Throws:
java.io.IOException- If deserialization failsjava.lang.ClassNotFoundException- If the value class is not found
-
getValueData
public byte[] getValueData()
Gets the serialized value data.- Returns:
- The serialized value data
-
getDiffValue
public byte[] getDiffValue()
Gets the diff value data.- Returns:
- The diff value data
-
getBackupNodes
public Member[] getBackupNodes()
Gets the backup nodes.- Returns:
- The backup nodes
-
getPrimary
public Member getPrimary()
Gets the primary member.- Returns:
- The primary member
-
getMapId
public byte[] getMapId()
Gets the map identifier.- Returns:
- the map identifier
-
setValue
public void setValue(java.io.Serializable value)
Sets the value for this message.- Parameters:
value- The value
-
setKey
public void setKey(java.io.Serializable key)
Sets the key for this message.- Parameters:
key- The key
-
clone
public AbstractReplicatedMap.MapMessage clone()
Creates a shallow copy of this map message.- Overrides:
clonein classjava.lang.Object- Returns:
- a shallow copy of this map message
-
-