Top Description Inners Fields Constructors Methods
com.sun.faces.util

public abstract Class ConcurrentCache<K, V>

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.faces.util.ExpiringConcurrentCache, com.sun.faces.facelets.impl.DefaultFaceletCache.NoCache
Imports
java.util.concurrent.ExecutionException

Defines a concurrent cache with a factory for creating new object instances. This (combined with ExpiringConcurrentCache) offers functionality similar to com.sun.faces.util.Cache. Two differences: 1. Cache is concrete/assumes a particular implementation. ConcurrentCache is abstract/allows subclasses to provide the implementation. This facilitates alternative implementations, such as DefaultFaceletCache's NoCache. 2. ConcurrentCache does not provide remove() as part of its contract, since remove behavior may be subclass-specific. For example, ExpiringConcurentCache automatically removes items by checking for expiration rather than requiring manual removes. We should consider consolidating Cache and ConcurrentCache + ExpiringConcurrentCache into a single class hierarchy so that we do not need to duplicate the JCIP scalable result cache code.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ConcurrentCache.Factory<K, V>

Factory interface for creating various cacheable objects.

Field Summary

Modifier and TypeField and Description
private final ConcurrentCache.Factory<K, V>

Constructor Summary

AccessConstructor and Description
public
ConcurrentCache(ConcurrentCache.Factory<K, V> f)

Constructs this cache using the specified Factory.

Method Summary

Modifier and TypeMethod and Description
public abstract boolean

Returns:

true if the value for the specified key is already cached, false otherwise
containsKey
(final K
key to test
key
)

Tests whether the cache contains a value for the specified key

public abstract V

Returns:

the value for the specified key
get
(final K
the key the value is associated with
key
)

Retrieves a value for the specified key.

protected final ConcurrentCache.Factory<K, V>

Returns:

Factory instance
getFactory
()

Retrieves a Factory instance aasociated with this cache

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_fback to summary
private final ConcurrentCache.Factory<K, V> _f

Constructor Detail

ConcurrentCacheback to summary
public ConcurrentCache(ConcurrentCache.Factory<K, V> f)

Constructs this cache using the specified Factory.

Method Detail

containsKeyback to summary
public abstract boolean containsKey(final K key)

Tests whether the cache contains a value for the specified key

Parameters
key:K

key to test

Returns:boolean

true if the value for the specified key is already cached, false otherwise

getback to summary
public abstract V get(final K key) throws ExecutionException

Retrieves a value for the specified key. If the value is not already present in the cache, a new instance will be allocated using the Factory interface

Parameters
key:K

the key the value is associated with

Returns:V

the value for the specified key

getFactoryback to summary
protected final ConcurrentCache.Factory<K, V> getFactory()

Retrieves a Factory instance aasociated with this cache

Returns:ConcurrentCache.Factory<K, V>

Factory instance

com.sun.faces.util back to summary

public Interface ConcurrentCache.Factory<K, V>


Factory interface for creating various cacheable objects.

Method Summary

Modifier and TypeMethod and Description
public V
newInstance(final K arg)

Method Detail

newInstanceback to summary
public V newInstance(final K arg) throws Exception