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

## com.sun.enterprise.ee.cms.core
Interface DistributedStateCache

All Known Implementing Classes:
  DistributedStateCacheImpl

    public interface DistributedStateCache

Represents a Caching facility that allows each member of the group to use key-value pairs representing the key to their cachable state and the value being serializable objects representing a state to be cached. This allows a group member to cache some state so that all members can access this cache through a distributed datastructure. When new members arrive to the group, the underlying implementation could choose to ensure that they get the current cache of states to sync with the group. Underlying implementations could also choose to share the cache with all members of the group or pick specific replicas.

Version:
  $Revision: 1.3 $
Author:
  Shreedhar Ganapathy Date: Dec 7, 2004

Method Summary
`void` | `addToCache(String componentName, String memberTokenId, Serializable key, Serializable state)` Caches a serializable object representing state to be cached.
`void` | `addToLocalCache(String componentName, String memberTokenId, Serializable key, Serializable state)` Locally caches a serializable object representing state to be cached.
`boolean` | `contains(Object key)` returns true if the DSC contains an entry wherein the component key portion of the composite key in the DSC is the same as the key specified in the argument
`boolean` | `contains(String componentName, Object key)` returns true if the DSC contains an entry wherein the componentName and the componet key portion of the composite key in the DSC is the same as the parameters specified in the argument
`Map` | `getAllCache()` returns the current cache state to caller.
`Map<GMSCacheable,Object>` | `getFromCache(Object key)` returns a Map containing entries that are in the DSC where either the componentName or the memberToken or the key is the same as the key specified in the argument.
`Object` | `getFromCache(String componentName, String memberTokenId, Serializable key)` retrieves the cache for the given composite key of component name, member token id and the key.
`Map<Serializable,Serializable>` | `getFromCacheForPattern(String componentName, String memberToken)` returns a Map containing key-value pairs matching entries that have keys with the given componentName and memberToken
`boolean` | `isFirstSyncDone()` returns true if this cache has been sync'd with any other member For implementations that do not intend to have a synchronized cache on all members, this method can be a no-op
`void` | `removeAll()` Empties the DistributedStateCache.
`void` | `removeAllForMember(String memberToken)` Empties the DistributedStateCache entries pertaining to a particular member.
`void` | `removeFromCache(String componentName, String memberTokenId, Serializable key)` removes an entry from the cache for the given composite key of the component name, member token id and the specific key.

Method Detail

### addToCache

    void addToCache(String componentName,
                    String memberTokenId,
                    Serializable key,
                    Serializable state)
                    throws GMSException

  Caches a serializable object representing state to be cached. The key to this cache for the implementation is the composite key comprising the component name, the memberTokenId and the component-provided key itself.

  Parameters:
    `componentName` - - name of the GMS client component that is storing this cache
    `memberTokenId` - - member token Id of this member
    `key` - - a serializable key that differentiates this cache from other caches of the same component and member.
    `state` - - a serializable object representing the cachable state
  Throws:
    `GMSException`

### addToLocalCache

    void addToLocalCache(String componentName,
                         String memberTokenId,
                         Serializable key,
                         Serializable state)

  Locally caches a serializable object representing state to be cached. The key to this cache for the implementation is the composite key comprising the component name, the memberTokenId and the component-provided key itself. NOTE: Calling this method does not result in information being shared with remote members. This is for local storage only.

  Parameters:
    `componentName` - Name of GMS Client component
    `memberTokenId` - Member's identity
    `key` - - an Object
    `state` - - an Object

### getFromCache

    Object getFromCache(String componentName,
                        String memberTokenId,
                        Serializable key)
                        throws GMSException

  retrieves the cache for the given composite key of component name, member token id and the key. Returns a cached Serializable object.

  Parameters:
    `componentName` - Name of GMS Client component
    `memberTokenId` - Member's identity
    `key` - - a serializable key that differentiates this cache entry from other cache entries.
  Returns:
    Object
  Throws:
    `GMSException`

### getAllCache

    Map getAllCache()

  returns the current cache state to caller.

  Returns:
    Map - containing the cache of this DSC instance

### removeFromCache

    void removeFromCache(String componentName,
                         String memberTokenId,
                         Serializable key)
                         throws GMSException

  removes an entry from the cache for the given composite key of the component name, member token id and the specific key.

  Parameters:
    `componentName` - Name of GMS Client component
    `memberTokenId` - Member's identity
    `key` - The component provided key
  Throws:
    `GMSException`

### getFromCacheForPattern

    Map<Serializable,Serializable> getFromCacheForPattern(String componentName,
                                                          String memberToken)

  returns a Map containing key-value pairs matching entries that have keys with the given componentName and memberToken

  Parameters:
    `componentName` - Name of GMS Client component
    `memberToken` - Member's identity
  Returns:
    Map - containing key value pairs for all entries that have the given component name and memberToken

### getFromCache

    Map<GMSCacheable,Object> getFromCache(Object key)

  returns a Map containing entries that are in the DSC where either the componentName or the memberToken or the key is the same as the key specified in the argument.

  Parameters:
    `key` - The key here is one of MemberToken, ComponentName, or the component-provided key itself
  Returns:
    Map

### contains

    boolean contains(Object key)

  returns true if the DSC contains an entry wherein the component key portion of the composite key in the DSC is the same as the key specified in the argument

  Parameters:
    `key` - component-provided key
  Returns:
    boolean true if the component-provided key exists in cache

### contains

    boolean contains(String componentName,
                     Object key)

  returns true if the DSC contains an entry wherein the componentName and the componet key portion of the composite key in the DSC is the same as the parameters specified in the argument

  Parameters:
    `componentName` - Name of component
    `key` - component-provided key
  Returns:
    boolean true if the key for the specified component exists

### isFirstSyncDone

    boolean isFirstSyncDone()

  returns true if this cache has been sync'd with any other member For implementations that do not intend to have a synchronized cache on all members, this method can be a no-op

  Returns:
    boolean

### removeAll

    void removeAll()

  Empties the DistributedStateCache. This is typically called in a group shutdown context so that the group's stale date is not retained for any later lives of the group.

### removeAllForMember

    void removeAllForMember(String memberToken)

  Empties the DistributedStateCache entries pertaining to a particular member. If this member's id appears in any part of the key or value of the cache, then that entry is removed. Typically, this is called when a particular member is being administratively shutdown and remaining members internally call this api when notified of this impending shutdown.

  Parameters:
    `memberToken` - member's identity

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

Copyright © 2003 Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.