public class ResourceCache
extends java.lang.Object
This is the caching mechanism for caching ResourceInfo instances to offset the cost of looking up the resource.
This cache uses a background thread to check for modifications to the underlying
webapp or JAR files containing resources. This check is periodic, configurable
via context init param com.sun.faces.resourceUpdateCheckPeriod
. Through
this config option, the cache can also be made static or completely disabled.
If the value of of this option is 0
, then no check will be made
making the cache static. If value of this option is less than 0
,
then no caching will be perfomed. Otherwise, the value of the option will
be the number of minutes between modification checks.
Modifier and Type | Class and Description |
---|---|
private static class |
ResourceCache.ResourceInfoCheckPeriodProxy |
Modifier and Type | Field and Description |
---|---|
private long |
checkPeriod
Resource check period in minutes.
|
private static java.util.logging.Logger |
LOGGER |
private MultiKeyConcurrentHashMap<java.lang.Object,ResourceCache.ResourceInfoCheckPeriodProxy> |
resourceCache
The
ResourceInfo |
Modifier | Constructor and Description |
---|---|
|
ResourceCache()
Constructs a new ResourceCache.
|
(package private) |
ResourceCache(long period) |
private |
ResourceCache(WebConfiguration config) |
Modifier and Type | Method and Description |
---|---|
ResourceInfo |
add(ResourceInfo info,
java.util.List<java.lang.String> contracts)
Add the
ResourceInfo to the internal cache. |
void |
clear()
Empty the cache.
|
ResourceInfo |
get(java.lang.String name,
java.lang.String libraryName,
java.lang.String localePrefix,
java.util.List<java.lang.String> contracts) |
private static java.lang.Long |
getCheckPeriod(WebConfiguration webConfig) |
private static java.lang.String |
getServletContextIdentifier(javax.servlet.ServletContext context) |
private static final java.util.logging.Logger LOGGER
private MultiKeyConcurrentHashMap<java.lang.Object,ResourceCache.ResourceInfoCheckPeriodProxy> resourceCache
ResourceInfo cache.
private long checkPeriod
public ResourceCache()
private ResourceCache(WebConfiguration config)
ResourceCache(long period)
public ResourceInfo add(ResourceInfo info, java.util.List<java.lang.String> contracts)
ResourceInfo
to the internal cache.info
- resource metadatacontracts
- the contractspublic ResourceInfo get(java.lang.String name, java.lang.String libraryName, java.lang.String localePrefix, java.util.List<java.lang.String> contracts)
name
- the resource namelibraryName
- the library namelocalePrefix
- the locale prefixcontracts
- the contractsResourceInfo
associated with key
if any.
public void clear()
Empty the cache.
private static java.lang.Long getCheckPeriod(WebConfiguration webConfig)
private static java.lang.String getServletContextIdentifier(javax.servlet.ServletContext context)
Copyright © 2002-2013 Oracle America, Inc. All Rights Reserved.