|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.softamis.net.cache.impl.MapBasedCache<K,V>
org.softamis.net.cache.impl.DefaultDistributedCache<K,V>
K
- type of keys used to identify cache itemsV
- type of values stored in the cachepublic class DefaultDistributedCache<K extends java.io.Serializable,V extends java.io.Serializable>
Implementation of cache that synchronizes it's states over network.
It relies on CommunicationHelper
to perform necesary network
communications.
Also, this implementation does not handle possible collisions that could occur
due to simultaneous update of cache content in varios places over network.
If item under the same key is added to cache in several places, only order
of underlying network notifications about changes will determine the value
which will be actually stored in cache which synchronized.
Field Summary | |
---|---|
protected CommunicationHelper<K,V> |
fCommunicationHelper
CommunicationHelper responsible for performing network communications |
Fields inherited from class org.softamis.net.cache.impl.MapBasedCache |
---|
fCacheLock, fData |
Constructor Summary | |
---|---|
DefaultDistributedCache()
|
Method Summary | |
---|---|
void |
close()
Closes ProvidingRegistry. |
protected void |
doAfterObjectAdded(K aKey,
V aValue)
Method called after adding object to the cache. |
protected void |
doAfterUpdate()
Method called after cache updates. |
protected void |
doInit()
|
CommunicationHelper<K,V> |
getCommunicationHelper()
Returns communicationHelper responsible for performing network communications |
void |
init()
Method that performs initialization of the registry provider by additing it as listener to CommunicationHelper used to perform network communication. |
protected void |
insureCommunicationHelperSet()
|
void |
processItemInvalid(ItemEntry<K,V> aEntry)
Callback for processing CommunicationHelper.COMMAND_ITEM_INVALID notification |
void |
processItemRegistered(ItemEntry<K,V> aEntry)
Callback for processing CommunicationHelper.COMMAND_ITEM_REGISTERED notification |
void |
processItemsRequest(ItemEntry<K,V> aEntry)
Callback for processing CommunicationHelper.COMMAND_ITEM_REQUEST notification - typically will be processed by
ProvidingRegistry |
void |
processItemUnregistered(ItemEntry<K,V> aEntry)
Callback for processing CommunicationHelper.COMMAND_ITEM_UNREGISTERED notification |
void |
setCommunicationHelper(CommunicationHelper<K,V> aCommunicationHelper)
Sets communicationHelper responsible for performing network communications |
Methods inherited from class org.softamis.net.cache.impl.MapBasedCache |
---|
clear, getKeys, getObject, getValues, saveObject, size, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected CommunicationHelper<K extends java.io.Serializable,V extends java.io.Serializable> fCommunicationHelper
Constructor Detail |
---|
public DefaultDistributedCache()
Method Detail |
---|
protected void doAfterUpdate()
MapBasedCache
doAfterUpdate
in class MapBasedCache<K extends java.io.Serializable,V extends java.io.Serializable>
public void processItemInvalid(ItemEntry<K,V> aEntry)
RegistryEventProcessor
CommunicationHelper.COMMAND_ITEM_INVALID
notification
processItemInvalid
in interface RegistryEventProcessor<K extends java.io.Serializable,V extends java.io.Serializable>
aEntry
- recevied item entrypublic void processItemRegistered(ItemEntry<K,V> aEntry)
RegistryEventProcessor
CommunicationHelper.COMMAND_ITEM_REGISTERED
notification
processItemRegistered
in interface RegistryEventProcessor<K extends java.io.Serializable,V extends java.io.Serializable>
aEntry
- recevied item entrypublic void processItemsRequest(ItemEntry<K,V> aEntry)
RegistryEventProcessor
CommunicationHelper.COMMAND_ITEM_REQUEST
notification - typically will be processed by
ProvidingRegistry
processItemsRequest
in interface RegistryEventProcessor<K extends java.io.Serializable,V extends java.io.Serializable>
aEntry
- recevied item entrypublic void processItemUnregistered(ItemEntry<K,V> aEntry)
RegistryEventProcessor
CommunicationHelper.COMMAND_ITEM_UNREGISTERED
notification
processItemUnregistered
in interface RegistryEventProcessor<K extends java.io.Serializable,V extends java.io.Serializable>
aEntry
- recevied item entryprotected void doAfterObjectAdded(K aKey, V aValue)
MapBasedCache
doAfterObjectAdded
in class MapBasedCache<K extends java.io.Serializable,V extends java.io.Serializable>
aKey
- key of itemaValue
- item addedprotected void insureCommunicationHelperSet()
public void init()
protected void doInit()
public void close()
public CommunicationHelper<K,V> getCommunicationHelper()
public void setCommunicationHelper(CommunicationHelper<K,V> aCommunicationHelper)
aCommunicationHelper
- communicationHelper
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |