org.jasig.portal.concurrency.caching
Class ReferenceEntityCachingService

java.lang.Object
  extended by org.jasig.portal.concurrency.caching.ReferenceEntityCachingService
All Implemented Interfaces:
IEntityCachingService

public class ReferenceEntityCachingService
extends java.lang.Object
implements IEntityCachingService

Caching service reference implementation.

Version:
$Revision: 1.11 $
Author:
Dan Ellentuck

Field Summary
private  java.util.Map caches
           
(package private)  int clockToleranceMillis
           
(package private)  int defaultMaxCacheSize
           
(package private)  int defaultMaxIdleTimeMillis
           
(package private)  int defaultSweepIntervalMillis
           
(package private)  boolean multiServer
           
private static IEntityCachingService singleton
           
 
Constructor Summary
ReferenceEntityCachingService()
          ReferenceEntityCachingService constructor comment.
 
Method Summary
 void add(IBasicEntity ent)
          Adds the entity to the cache.
(package private)  IEntityCache createCache(java.lang.Class type)
          Create a cache for a specific entity type.
private  void createCaches()
          Create a cache for each known entity type.
 IBasicEntity get(java.lang.Class type, java.lang.String key)
          Returns the cached entity identified by type and key.
 IEntityCache getCache(java.lang.Class type)
          Returns the IEntityCache for type.
protected  java.util.Map getCaches()
           
private  void initialize()
           
private  void loadDefaultProperties()
          Loads default properties applied to caches if not specifically overridden.
 IEntityCache newCache(java.lang.Class type, int maxSize, int maxIdleTime, int sweepInterval)
          Factory method returns a new instance of IEntityCache for type.
 void remove(java.lang.Class type, java.lang.String key)
          Removes the cached entity identified by type and key from the cache and notifies peer caches.
protected  void setCaches(java.util.Map newCaches)
           
static IEntityCachingService singleton()
           
 void update(IBasicEntity ent)
          Updates the entity in the cache and notifies peer caches.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

singleton

private static IEntityCachingService singleton

caches

private java.util.Map caches

multiServer

boolean multiServer

defaultMaxCacheSize

int defaultMaxCacheSize

defaultSweepIntervalMillis

int defaultSweepIntervalMillis

defaultMaxIdleTimeMillis

int defaultMaxIdleTimeMillis

clockToleranceMillis

int clockToleranceMillis
Constructor Detail

ReferenceEntityCachingService

public ReferenceEntityCachingService()
                              throws CachingException
ReferenceEntityCachingService constructor comment.

Throws:
CachingException
Method Detail

add

public void add(IBasicEntity ent)
         throws CachingException
Adds the entity to the cache.

Specified by:
add in interface IEntityCachingService
Parameters:
ent - org.jasig.portal.IBasicEntity
Throws:
CachingException

createCache

IEntityCache createCache(java.lang.Class type)
                   throws CachingException
Create a cache for a specific entity type.

Throws:
CachingException

createCaches

private void createCaches()
                   throws CachingException
Create a cache for each known entity type.

Throws:
CachingException

get

public IBasicEntity get(java.lang.Class type,
                        java.lang.String key)
                 throws CachingException
Returns the cached entity identified by type and key.

Specified by:
get in interface IEntityCachingService
Parameters:
type - Class
key - String
Returns:
IBasicEntity entity
Throws:
CachingException

getCache

public IEntityCache getCache(java.lang.Class type)
                      throws CachingException
Returns the IEntityCache for type.

Parameters:
type - Class
Returns:
IEntityCache
Throws:
CachingException

getCaches

protected java.util.Map getCaches()
Returns:
java.util.Map

initialize

private void initialize()
                 throws CachingException
Throws:
CachingException

loadDefaultProperties

private void loadDefaultProperties()
Loads default properties applied to caches if not specifically overridden.


newCache

public IEntityCache newCache(java.lang.Class type,
                             int maxSize,
                             int maxIdleTime,
                             int sweepInterval)
                      throws CachingException
Factory method returns a new instance of IEntityCache for type.

Parameters:
type - Class
maxSize - int - the maximum size of the cache.
maxIdleTime - int - the idle time in milliseconds after which a cache entry may be purged.
sweepInterval - int - the period of time in milliseconds between cache sweeps.
Returns:
IEntityCache
Throws:
CachingException

remove

public void remove(java.lang.Class type,
                   java.lang.String key)
            throws CachingException
Removes the cached entity identified by type and key from the cache and notifies peer caches.

Specified by:
remove in interface IEntityCachingService
Parameters:
type - Class
key - String
Throws:
CachingException

setCaches

protected void setCaches(java.util.Map newCaches)
Parameters:
newCaches - java.util.Map

singleton

public static IEntityCachingService singleton()
                                       throws CachingException
Returns:
org.jasig.portal.concurrency.IEntityCachingService
Throws:
CachingException

update

public void update(IBasicEntity ent)
            throws CachingException
Updates the entity in the cache and notifies peer caches.

Specified by:
update in interface IEntityCachingService
Parameters:
ent - org.jasig.portal.IBasicEntity
Throws:
CachingException