Top Description Inners Fields Constructors Methods
com.sun.faces.facelets.impl

pack-priv final Class DefaultFaceletCache

extends FaceletCache<DefaultFacelet>
Class Inheritance
Imports
java.io.IOException, java.net.URL, java.util.concurrent.ExecutionException, java.util.concurrent.atomic.AtomicLong, com.sun.faces.util.ConcurrentCache, .ExpiringConcurrentCache, .Util, jakarta.faces.FacesException, jakarta.faces.view.facelets.FaceletCache

Default FaceletCache implementation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
DefaultFaceletCache.NoCache

ConcurrentCache implementation that does no caching (always creates new instances)

private static class
DefaultFaceletCache.Record

This class holds the Facelet instance and its original URL's last modified time.

Field Summary

Modifier and TypeField and Description
private final ConcurrentCache<URL, DefaultFaceletCache.Record>
private final ConcurrentCache<URL, DefaultFaceletCache.Record>

Constructor Summary

AccessConstructor and Description
pack-priv
DefaultFaceletCache(final long
cache refresh period (in seconds). 0 means 'always refresh', negative value means 'never refresh'
refreshPeriod
)

Constructor

Method Summary

Modifier and TypeMethod and Description
private void
public DefaultFacelet
getFacelet(URL
URL for the Facelet being retrieved
url
)

Implements abstract jakarta.faces.view.facelets.FaceletCache.getFacelet.

Returns a cached Facelet instance.

public DefaultFacelet
getViewMetadataFacelet(URL
URL for the View Metadata Facelet being retrieved
url
)

Implements abstract jakarta.faces.view.facelets.FaceletCache.getViewMetadataFacelet.

Returns a cached View Metadata Facelet instance.

public boolean
isFaceletCached(URL
URL for the Facelet
url
)

Implements abstract jakarta.faces.view.facelets.FaceletCache.isFaceletCached.

Determines whether a cached Facelet instance exists for this URL.

public boolean
isViewMetadataFaceletCached(URL
URL for the View Metadata Facelet
url
)

Implements abstract jakarta.faces.view.facelets.FaceletCache.isViewMetadataFaceletCached.

Determines whether a cached View Metadata Facelet instance exists for this URL.

Inherited from jakarta.faces.view.facelets.FaceletCache:
getMemberFactorygetMetadataMemberFactorysetCacheFactories

Field Detail

_faceletCacheback to summary
private final ConcurrentCache<URL, DefaultFaceletCache.Record> _faceletCache
_metadataFaceletCacheback to summary
private final ConcurrentCache<URL, DefaultFaceletCache.Record> _metadataFaceletCache

Constructor Detail

DefaultFaceletCacheback to summary
pack-priv DefaultFaceletCache(final long refreshPeriod)

Constructor

Parameters
refreshPeriod:long

cache refresh period (in seconds). 0 means 'always refresh', negative value means 'never refresh'

Method Detail

_unwrapIOExceptionback to summary
private void _unwrapIOException(ExecutionException e) throws IOException
getFaceletback to summary
public DefaultFacelet getFacelet(URL url) throws IOException

Implements abstract jakarta.faces.view.facelets.FaceletCache.getFacelet.

Doc from jakarta.faces.view.facelets.FaceletCache.getFacelet.

Returns a cached Facelet instance. If no instance is available, it will be created using the Facelet MemberFactory and stored in the cache.

Parameters
url:URL

URL for the Facelet being retrieved

Returns:DefaultFacelet

a cached or new Facelet

Annotations
@Override
Exceptions
IOException:
if unable to load a file necessary to respond to service this method.
getViewMetadataFaceletback to summary
public DefaultFacelet getViewMetadataFacelet(URL url) throws IOException

Implements abstract jakarta.faces.view.facelets.FaceletCache.getViewMetadataFacelet.

Doc from jakarta.faces.view.facelets.FaceletCache.getViewMetadataFacelet.

Returns a cached View Metadata Facelet instance. If no instance is available, it will be created using the View Metadata Facelet MemberFactory and stored in the cache.

Parameters
url:URL

URL for the View Metadata Facelet being retrieved

Returns:DefaultFacelet

a cached or new View Metadata Facelet instance

Annotations
@Override
Exceptions
IOException:
if unable to load a file necessary to respond to service this method.
isFaceletCachedback to summary
public boolean isFaceletCached(URL url)

Implements abstract jakarta.faces.view.facelets.FaceletCache.isFaceletCached.

Doc from jakarta.faces.view.facelets.FaceletCache.isFaceletCached.

Determines whether a cached Facelet instance exists for this URL. Returns true if a cached instance exists, false otherwise

Parameters
url:URL

URL for the Facelet

Returns:boolean

true if a cached instance exists, false otherwise

Annotations
@Override
isViewMetadataFaceletCachedback to summary
public boolean isViewMetadataFaceletCached(URL url)

Implements abstract jakarta.faces.view.facelets.FaceletCache.isViewMetadataFaceletCached.

Doc from jakarta.faces.view.facelets.FaceletCache.isViewMetadataFaceletCached.

Determines whether a cached View Metadata Facelet instance exists for this URL. Returns true if a cached instance exists, false otherwise

Parameters
url:URL

URL for the View Metadata Facelet

Returns:boolean

true if a cached instance exists, false otherwise

Annotations
@Override
com.sun.faces.facelets.impl back to summary

private Class DefaultFaceletCache.ExpiryChecker

extends Object
implements ExpiringConcurrentCache.ExpiryChecker<URL, DefaultFaceletCache.Record>
Class Inheritance
  • java.lang.Object
  • com.sun.faces.facelets.impl.DefaultFaceletCache.ExpiryChecker
All Implemented Interfaces
com.sun.faces.util.ExpiringConcurrentCache.ExpiryChecker

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
isExpired(URL
cache key
url
,
DefaultFaceletCache.Record
cached value
record
)

Implements com.sun.faces.util.ExpiringConcurrentCache.ExpiryChecker.isExpired.

Checks whether a cached object expired

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ExpiryCheckerback to summary
private ExpiryChecker()

Method Detail

isExpiredback to summary
public boolean isExpired(URL url, DefaultFaceletCache.Record record)

Implements com.sun.faces.util.ExpiringConcurrentCache.ExpiryChecker.isExpired.

Doc from com.sun.faces.util.ExpiringConcurrentCache.ExpiryChecker.isExpired.

Checks whether a cached object expired

Parameters
url:URL

cache key

record:DefaultFaceletCache.Record

cached value

Returns:boolean

true if the value expired and should be removed from the cache, false otherwise

Annotations
@Override
com.sun.faces.facelets.impl back to summary

private Class DefaultFaceletCache.NeverExpired

extends Object
implements ExpiringConcurrentCache.ExpiryChecker<URL, DefaultFaceletCache.Record>
Class Inheritance
All Implemented Interfaces
com.sun.faces.util.ExpiringConcurrentCache.ExpiryChecker

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
isExpired(URL
cache key
key
,
DefaultFaceletCache.Record
cached value
value
)

Implements com.sun.faces.util.ExpiringConcurrentCache.ExpiryChecker.isExpired.

Checks whether a cached object expired

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

NeverExpiredback to summary
private NeverExpired()

Method Detail

isExpiredback to summary
public boolean isExpired(URL key, DefaultFaceletCache.Record value)

Implements com.sun.faces.util.ExpiringConcurrentCache.ExpiryChecker.isExpired.

Doc from com.sun.faces.util.ExpiringConcurrentCache.ExpiryChecker.isExpired.

Checks whether a cached object expired

Parameters
key:URL

cache key

value:DefaultFaceletCache.Record

cached value

Returns:boolean

true if the value expired and should be removed from the cache, false otherwise

Annotations
@Override
com.sun.faces.facelets.impl back to summary

private Class DefaultFaceletCache.NoCache

extends ConcurrentCache<URL, DefaultFaceletCache.Record>
Class Inheritance

ConcurrentCache implementation that does no caching (always creates new instances)

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
containsKey(final URL
key to test
key
)

Implements abstract com.sun.faces.util.ConcurrentCache.containsKey.

Tests whether the cache contains a value for the specified key

public DefaultFaceletCache.Record
get(final URL
the key the value is associated with
key
)

Implements abstract com.sun.faces.util.ConcurrentCache.get.

Retrieves a value for the specified key.

Inherited from com.sun.faces.util.ConcurrentCache:
getFactory

Constructor Detail

NoCacheback to summary
public NoCache(ConcurrentCache.Factory<URL, DefaultFaceletCache.Record> f)

Method Detail

containsKeyback to summary
public boolean containsKey(final URL key)

Implements abstract com.sun.faces.util.ConcurrentCache.containsKey.

Doc from com.sun.faces.util.ConcurrentCache.containsKey.

Tests whether the cache contains a value for the specified key

Parameters
key:URL

key to test

Returns:boolean

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

Annotations
@Override
getback to summary
public DefaultFaceletCache.Record get(final URL key) throws ExecutionException

Implements abstract com.sun.faces.util.ConcurrentCache.get.

Doc from com.sun.faces.util.ConcurrentCache.get.

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:URL

the key the value is associated with

Returns:DefaultFaceletCache.Record

the value for the specified key

Annotations
@Override
com.sun.faces.facelets.impl back to summary

private Class DefaultFaceletCache.Record

extends Object
Class Inheritance

This class holds the Facelet instance and its original URL's last modified time. It also produces the time when the next expiry check should be performed

Field Summary

Modifier and TypeField and Description
private final long
private final DefaultFacelet
private final long
private final AtomicLong
private final long

Constructor Summary

AccessConstructor and Description
pack-priv
Record(long creationTime, long lastModified, DefaultFacelet facelet, long refreshInterval)

Method Summary

Modifier and TypeMethod and Description
pack-priv long
pack-priv DefaultFacelet
pack-priv long
pack-priv long
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_creationTimeback to summary
private final long _creationTime
_faceletback to summary
private final DefaultFacelet _facelet
_lastModifiedback to summary
private final long _lastModified
_nextRefreshTimeback to summary
private final AtomicLong _nextRefreshTime
_refreshIntervalback to summary
private final long _refreshInterval

Constructor Detail

Recordback to summary
pack-priv Record(long creationTime, long lastModified, DefaultFacelet facelet, long refreshInterval)

Method Detail

getAndUpdateNextRefreshTimeback to summary
pack-priv long getAndUpdateNextRefreshTime()
getFaceletback to summary
pack-priv DefaultFacelet getFacelet()
getLastModifiedback to summary
pack-priv long getLastModified()
getNextRefreshTimeback to summary
pack-priv long getNextRefreshTime()