|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.enterprise.ee.cms.impl.base.DistributedStateCacheImpl
public class DistributedStateCacheImpl
Messaging based implementation of a shared distributed state cache(DSC). Every write entry made such as adding a new entry or removing an existing entry is disseminated to all group members through a message. Read-only operation i.e getFromCache() is a local call. During startup of a member, a singleton instance of this class is created. This instance is available to GMS client components in this member through GroupHandle.getDistributedStateCache() so that the client components can read or write to this cache.
When an entry is added or removed, this implementation uses underlying GroupCommunicationProvider(GCP) to sends a message to the all members of the group. The recipients in turn call corresponding method for adding or removing the entry to/from their copy of the this DistributedStateCache implementation.
When new member joins the group, the join notification is received on every member. When this happens, and if this member is a leader of the group, then it uses the GCP's messaging api to sends a message to the new member to pass on the current state of this DSC. The remote member updates its DSC with this current state while returning its own state to this member through another message. This member updates its own DSC with this new entry resulting in all members getting this updated state. This brings the group-wide DSC into a synchronized state.
This initial sync-up is a heavy weight operation particularly during startup of the whole group concurrently as new members are joining the group rapidly. To prevent data loss during such times, each sync activity will require a blocking call to ensure that rapid group view changes during group startup will not result in data loss.
| Method Summary | |
|---|---|
void |
addToCache(String componentName,
String memberTokenId,
Serializable key,
byte[] state)
|
void |
addToCache(String componentName,
String memberTokenId,
Serializable key,
Serializable state)
|
void |
addToLocalCache(GMSCacheable cKey,
Object state)
|
void |
addToLocalCache(String componentName,
String memberTokenId,
Serializable key,
byte[] state)
|
void |
addToLocalCache(String componentName,
String memberTokenId,
Serializable key,
Serializable state)
|
boolean |
contains(Object key)
|
boolean |
contains(String componentName,
Object key)
|
Map<GMSCacheable,Object> |
getAllCache()
|
Map<GMSCacheable,Object> |
getFromCache(Object key)
|
Object |
getFromCache(String componentName,
String memberTokenId,
Serializable key)
|
Map<Serializable,Serializable> |
getFromCacheForPattern(String componentName,
String memberToken)
|
boolean |
isFirstSyncDone()
|
void |
removeAll()
Empties the DistributedStateCache. |
void |
removeAllForMember(String memberToken)
|
void |
removeFromCache(String componentName,
String memberTokenId,
Serializable key)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public void addToCache(String componentName,
String memberTokenId,
Serializable key,
Serializable state)
throws GMSException
addToCache in interface DistributedStateCacheGMSException
public void addToCache(String componentName,
String memberTokenId,
Serializable key,
byte[] state)
throws GMSException
GMSException
public void addToLocalCache(String componentName,
String memberTokenId,
Serializable key,
Serializable state)
addToLocalCache in interface DistributedStateCache
public void addToLocalCache(String componentName,
String memberTokenId,
Serializable key,
byte[] state)
public void addToLocalCache(GMSCacheable cKey,
Object state)
public String toString()
toString in class Object
public void removeFromCache(String componentName,
String memberTokenId,
Serializable key)
throws GMSException
removeFromCache in interface DistributedStateCacheGMSException
public Object getFromCache(String componentName,
String memberTokenId,
Serializable key)
throws GMSException
getFromCache in interface DistributedStateCacheGMSExceptionpublic Map<GMSCacheable,Object> getAllCache()
getAllCache in interface DistributedStateCache
public Map<Serializable,Serializable> getFromCacheForPattern(String componentName,
String memberToken)
getFromCacheForPattern in interface DistributedStateCachepublic Map<GMSCacheable,Object> getFromCache(Object key)
getFromCache in interface DistributedStateCachepublic boolean contains(Object key)
contains in interface DistributedStateCache
public boolean contains(String componentName,
Object key)
contains in interface DistributedStateCachepublic boolean isFirstSyncDone()
isFirstSyncDone in interface DistributedStateCachepublic void removeAll()
removeAll in interface DistributedStateCachepublic void removeAllForMember(String memberToken)
removeAllForMember in interface DistributedStateCache
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||