Package org.apache.catalina.tribes.tipis
Class AbstractReplicatedMap.MapEntry<K,V>
- java.lang.Object
-
- org.apache.catalina.tribes.tipis.AbstractReplicatedMap.MapEntry<K,V>
-
- Type Parameters:
K- The type of keys maintained by this mapV- The type of mapped values
- All Implemented Interfaces:
java.util.Map.Entry<K,V>
- Enclosing class:
- AbstractReplicatedMap<K,V>
public static class AbstractReplicatedMap.MapEntry<K,V> extends java.lang.Object implements java.util.Map.Entry<K,V>Represents an entry in the replicated map, including metadata about its role (primary, backup, proxy).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(byte[] data, int offset, int length, boolean diff)apply a diff, or an entire objectbooleanequals(java.lang.Object o)Member[]getBackupNodes()Gets the backup nodes for this entry.KgetKey()Gets the key for this entry.MembergetPrimary()Gets the primary member for this entry.VgetValue()Gets the value for this entry.inthashCode()booleanisActive()Checks if this entry is active.booleanisBackup()Checks if this entry is a backup.booleanisCopy()Checks if this entry is a copy.booleanisDiffable()Checks if this entry is diffable.booleanisKeySerializable()Checks if the key is serializable.booleanisPrimary()Checks if this entry is primary.booleanisProxy()Checks if this entry is a proxy.booleanisSerializable()Checks if both the key and value are serializable.booleanisValueSerializable()Checks if the value is serializable.voidsetBackup(boolean backup)Sets whether this entry is a backup.voidsetBackupNodes(Member[] nodes)Sets the backup nodes for this entry.voidsetCopy(boolean copy)Sets whether this entry is a copy.KsetKey(K key)Sets the key for this entry.voidsetPrimary(Member m)Sets the primary member for this entry.voidsetProxy(boolean proxy)Sets whether this entry is a proxy.VsetValue(V value)Sets the value for this entry.java.lang.StringtoString()Returns a string representation of this map entry.
-
-
-
Method Detail
-
isKeySerializable
public boolean isKeySerializable()
Checks if the key is serializable.- Returns:
trueif the key is serializable or null
-
isValueSerializable
public boolean isValueSerializable()
Checks if the value is serializable.- Returns:
trueif the value is serializable or null
-
isSerializable
public boolean isSerializable()
Checks if both the key and value are serializable.- Returns:
trueif both key and value are serializable
-
isBackup
public boolean isBackup()
Checks if this entry is a backup.- Returns:
trueif this entry is a backup
-
setBackup
public void setBackup(boolean backup)
Sets whether this entry is a backup.- Parameters:
backup-trueif this entry is a backup
-
isProxy
public boolean isProxy()
Checks if this entry is a proxy.- Returns:
trueif this entry is a proxy
-
isPrimary
public boolean isPrimary()
Checks if this entry is primary.- Returns:
trueif this entry is primary
-
isActive
public boolean isActive()
Checks if this entry is active.- Returns:
trueif this entry is active
-
setProxy
public void setProxy(boolean proxy)
Sets whether this entry is a proxy.- Parameters:
proxy-trueif this entry is a proxy
-
isCopy
public boolean isCopy()
Checks if this entry is a copy.- Returns:
trueif this entry is a copy
-
setCopy
public void setCopy(boolean copy)
Sets whether this entry is a copy.- Parameters:
copy-trueif this entry is a copy
-
isDiffable
public boolean isDiffable()
Checks if this entry is diffable.- Returns:
trueif this entry is diffable
-
setBackupNodes
public void setBackupNodes(Member[] nodes)
Sets the backup nodes for this entry.- Parameters:
nodes- The backup nodes
-
getBackupNodes
public Member[] getBackupNodes()
Gets the backup nodes for this entry.- Returns:
- The backup nodes
-
setPrimary
public void setPrimary(Member m)
Sets the primary member for this entry.- Parameters:
m- The primary member
-
getPrimary
public Member getPrimary()
Gets the primary member for this entry.- Returns:
- The primary member
-
getValue
public V getValue()
Gets the value for this entry.
-
getKey
public K getKey()
Gets the key for this entry.
-
setKey
public K setKey(K key)
Sets the key for this entry.- Parameters:
key- The new key- Returns:
- The previous key
-
hashCode
public int hashCode()
-
equals
public boolean equals(java.lang.Object o)
-
apply
public void apply(byte[] data, int offset, int length, boolean diff) throws java.io.IOException, java.lang.ClassNotFoundExceptionapply a diff, or an entire object- Parameters:
data- byte[]offset- intlength- intdiff- boolean- Throws:
java.io.IOException- IO errorjava.lang.ClassNotFoundException- Deserialization error
-
toString
public java.lang.String toString()
Returns a string representation of this map entry.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of this map entry
-
-