org.apache.catalina.tribes.tipis

Class ReplicatedMap

public class ReplicatedMap extends AbstractReplicatedMap implements RpcCallback, ChannelListener, MembershipListener

All-to-all replication for a hash map implementation. Each node in the cluster will carry an identical copy of the map.

This map implementation doesn't have a background thread running to replicate changes. If you do have changes without invoking put/remove then you need to invoke one of the following methods: the boolean value in the replicate method used to decide whether to only replicate objects that implement the ReplicatedMapEntry interface or to replicate all objects. If an object doesn't implement the ReplicatedMapEntry interface each time the object gets replicated the entire object gets serialized, hence a call to replicate(true) will replicate all objects in this map that are using this node as primary.

REMBER TO CALL breakdown() or finalize() when you are done with the map to avoid memory leaks.

Version: 1.0

Author: Filip Hanik

UNKNOWN: implement periodic sync/transfer thread memberDisappeared, should do nothing except change map membership by default it relocates the primary objects

Field Summary
protected static Loglog
Constructor Summary
ReplicatedMap(AbstractReplicatedMap.MapOwner owner, Channel channel, long timeout, String mapContextName, int initialCapacity, float loadFactor, ClassLoader[] cls)
Creates a new map
ReplicatedMap(AbstractReplicatedMap.MapOwner owner, Channel channel, long timeout, String mapContextName, int initialCapacity, ClassLoader[] cls)
Creates a new map
ReplicatedMap(AbstractReplicatedMap.MapOwner owner, Channel channel, long timeout, String mapContextName, ClassLoader[] cls)
Creates a new map
Method Summary
protected intgetStateMessageType()
protected Member[]publishEntryInfo(Object key, Object value)
publish info about a map pair (key/value) to other nodes in the cluster

Field Detail

log

protected static Log log

Constructor Detail

ReplicatedMap

public ReplicatedMap(AbstractReplicatedMap.MapOwner owner, Channel channel, long timeout, String mapContextName, int initialCapacity, float loadFactor, ClassLoader[] cls)
Creates a new map

Parameters: channel The channel to use for communication timeout long - timeout for RPC messags mapContextName String - unique name for this map, to allow multiple maps per channel initialCapacity int - the size of this map, see HashMap loadFactor float - load factor, see HashMap

ReplicatedMap

public ReplicatedMap(AbstractReplicatedMap.MapOwner owner, Channel channel, long timeout, String mapContextName, int initialCapacity, ClassLoader[] cls)
Creates a new map

Parameters: channel The channel to use for communication timeout long - timeout for RPC messags mapContextName String - unique name for this map, to allow multiple maps per channel initialCapacity int - the size of this map, see HashMap

ReplicatedMap

public ReplicatedMap(AbstractReplicatedMap.MapOwner owner, Channel channel, long timeout, String mapContextName, ClassLoader[] cls)
Creates a new map

Parameters: channel The channel to use for communication timeout long - timeout for RPC messags mapContextName String - unique name for this map, to allow multiple maps per channel

Method Detail

getStateMessageType

protected int getStateMessageType()

publishEntryInfo

protected Member[] publishEntryInfo(Object key, Object value)
publish info about a map pair (key/value) to other nodes in the cluster

Parameters: key Object value Object

Returns: Member - the backup node

Throws: ChannelException

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