Top Description Inners Fields Constructors Methods
com.sun.faces.application.resource

public Class ResourceCache

extends Object
Class Inheritance
Imports
com.sun.faces.config.WebConfiguration, .WebConfiguration.WebContextInitParameter, com.sun.faces.util.FacesLogger, .MultiKeyConcurrentHashMap, .Util, javax.servlet.ServletContext, java.util.ArrayList, .List, java.util.logging.Level, .Logger

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private long
checkPeriod

Resource check period in minutes.

private static final Logger
private MultiKeyConcurrentHashMap<Object, ResourceCache.ResourceInfoCheckPeriodProxy>
resourceCache

The ResourceInfo cache.

Constructor Summary

AccessConstructor and Description
public
ResourceCache()

Constructs a new ResourceCache.

private
pack-priv
ResourceCache(long period)

Method Summary

Modifier and TypeMethod and Description
public ResourceInfo

Returns:

previous value associated with specified key, or null if there was no mapping for key
add
(ResourceInfo
resource metadata
info
,
List<String>
the contracts
contracts
)

Add the ResourceInfo to the internal cache.

public void
clear()

Empty the cache.

public ResourceInfo

Returns:

the ResourceInfo associated with key if any.
get
(String
the resource name
name
,
String
the library name
libraryName
,
String
the locale prefix
localePrefix
,
List<String>
the contracts
contracts
)

private static Long
private static String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

checkPeriodback to summary
private long checkPeriod

Resource check period in minutes.

LOGGERback to summary
private static final Logger LOGGER
resourceCacheback to summary
private MultiKeyConcurrentHashMap<Object, ResourceCache.ResourceInfoCheckPeriodProxy> resourceCache

The ResourceInfo cache.

Constructor Detail

ResourceCacheback to summary
public ResourceCache()

Constructs a new ResourceCache.

ResourceCacheback to summary
private ResourceCache(WebConfiguration config)
ResourceCacheback to summary
pack-priv ResourceCache(long period)

Method Detail

addback to summary
public ResourceInfo add(ResourceInfo info, List<String> contracts)

Add the ResourceInfo to the internal cache.

Parameters
info:ResourceInfo

resource metadata

contracts:List<String>

the contracts

Returns:ResourceInfo

previous value associated with specified key, or null if there was no mapping for key

clearback to summary
public void clear()

Empty the cache.

getback to summary
public ResourceInfo get(String name, String libraryName, String localePrefix, List<String> contracts)
Parameters
name:String

the resource name

libraryName:String

the library name

localePrefix:String

the locale prefix

contracts:List<String>

the contracts

Returns:ResourceInfo

the ResourceInfo associated with key if any.

getCheckPeriodback to summary
private static Long getCheckPeriod(WebConfiguration webConfig)
getServletContextIdentifierback to summary
private static String getServletContextIdentifier(ServletContext context)
com.sun.faces.application.resource back to summary

private final Class ResourceCache.ResourceInfoCheckPeriodProxy

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.faces.application.resource.ResourceCache.ResourceInfoCheckPeriodProxy

Field Summary

Modifier and TypeField and Description
private Long
private ResourceInfo

Constructor Summary

AccessConstructor and Description
public
ResourceInfoCheckPeriodProxy(ResourceInfo resourceInfo, long checkPeriod)

Method Summary

Modifier and TypeMethod and Description
private ResourceInfo
private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

checkTimeback to summary
private Long checkTime
resourceInfoback to summary
private ResourceInfo resourceInfo

Constructor Detail

ResourceInfoCheckPeriodProxyback to summary
public ResourceInfoCheckPeriodProxy(ResourceInfo resourceInfo, long checkPeriod)

Method Detail

getResourceInfoback to summary
private ResourceInfo getResourceInfo()
needsRefreshedback to summary
private boolean needsRefreshed()