ReplicatedMap (Tomcat API Documentation)
Keywords: org.apache.catalina.tribes.tipis.ReplicatedMap class

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

## org.apache.catalina.tribes.tipis
Class ReplicatedMap

    java.lang.Object
      java.util.AbstractMap<K,V>
          java.util.concurrent.ConcurrentHashMap
              org.apache.catalina.tribes.tipis.AbstractReplicatedMap
                  org.apache.catalina.tribes.tipis.ReplicatedMap

All Implemented Interfaces:
  java.io.Serializable, java.util.concurrent.ConcurrentMap, java.util.Map, ChannelListener, RpcCallback, Heartbeat, MembershipListener

    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:

- `replicate(Object,boolean)` - replicates only the object that belongs to the key
- `replicate(boolean)` - Scans the entire map for changes and replicates data

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
See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.catalina.tribes.tipis.AbstractReplicatedMap
`AbstractReplicatedMap.MapEntry, AbstractReplicatedMap.MapMessage, AbstractReplicatedMap.MapOwner`

Nested classes/interfaces inherited from interface java.util.Map
`java.util.Map.Entry<K,V>`

Field Summary
`protected static Log` | `log`

Fields inherited from class org.apache.catalina.tribes.tipis.AbstractReplicatedMap
`accessTimeout, channel, channelSendOptions, currentNode, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, externalLoaders, mapContextName, mapMembers, mapname, mapOwner, rpcChannel, rpcTimeout, stateMutex, stateTransferred`

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

Method Summary
`protected int` | `getStateMessageType()`
`protected Member[]` | `publishEntryInfo(java.lang.Object key, java.lang.Object value)` publish info about a map pair (key/value) to other nodes in the cluster

Methods inherited from class org.apache.catalina.tribes.tipis.AbstractReplicatedMap
`accept, breakdown, broadcast, clear, clear, clone, containsKey, containsValue, entrySet, entrySetFull, equals, excludeFromSet, finalize, get, getAccessTimeout, getChannel, getChannelSendOptions, getExternalLoaders, getInternal, getMapContextName, getMapMembers, getMapMembers, getMapMembersExcl, getMapOwner, getNextBackupIndex, getNextBackupNode, getRpcChannel, getRpcTimeout, getStateMutex, hashCode, heartbeat, init, inSet, isEmpty, isStateTransferred, keySet, keySetFull, leftOver, mapMemberAdded, memberAdded, memberAlive, memberDisappeared, messageReceived, ping, printMap, put, put, putAll, remove, remove, removeEldestEntry, replicate, replicate, replyRequest, setAccessTimeout, setChannelSendOptions, setExternalLoaders, setMapOwner, size, sizeFull, transferState, values, wrap`

Methods inherited from class java.util.concurrent.ConcurrentHashMap
`contains, elements, keys, putIfAbsent, remove, replace, replace`

Methods inherited from class java.util.AbstractMap
`toString`

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

Methods inherited from interface org.apache.catalina.tribes.group.RpcCallback
`leftOver, replyRequest`

Methods inherited from interface org.apache.catalina.tribes.ChannelListener
`accept, equals, hashCode, messageReceived`

Methods inherited from interface org.apache.catalina.tribes.MembershipListener
`memberAdded, memberDisappeared`

Field Detail

### log

    protected static Log log

Constructor Detail

### ReplicatedMap

    public ReplicatedMap(AbstractReplicatedMap.MapOwner owner,
                         Channel channel,
                         long timeout,
                         java.lang.String mapContextName,
                         int initialCapacity,
                         float loadFactor,
                         java.lang.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,
                         java.lang.String mapContextName,
                         int initialCapacity,
                         java.lang.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,
                         java.lang.String mapContextName,
                         java.lang.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()

  Specified by:
    `getStateMessageType` in class `AbstractReplicatedMap`

### publishEntryInfo

    protected Member[] publishEntryInfo(java.lang.Object key,
                                        java.lang.Object value)
                                 throws ChannelException

  publish info about a map pair (key/value) to other nodes in the cluster

  Specified by:
    `publishEntryInfo` in class `AbstractReplicatedMap`
  Parameters:
    `key` - Object
    `value` - Object
  Returns:
    Member - the backup node
  Throws:
    `ChannelException`

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

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