com.sun.grizzly.http
Class FileCacheFactory

java.lang.Object
  extended by com.sun.grizzly.http.FileCacheFactory
Direct Known Subclasses:
SSLFileCacheFactory

public class FileCacheFactory
extends Object

A factory for creating FileCache instance.

Author:
Jeanfrancois Arcand

Field Summary
protected static ConcurrentHashMap<Integer,FileCacheFactory> cache
          Create a factory per port.
protected  ConcurrentLinkedQueue<FileCache.FileCacheEntry> cacheManager
          The cache manager used by instance of FileCache created by this factory;
protected  FileCache fileCache
          A list of FileCache instance this Factory is owning.
static boolean isEnabled
          Is the FileCache enabled.
 boolean isLargeFileCacheEnabled
          Is the large FileCache enabled.
protected  boolean isMonitoringEnabled
          Is monitoring enabled
 int maxCacheEntries
          The maximum entries in the fileCache
 long maxEntrySize
          The maximum size of a cached resources.
 long maxLargeFileCacheSize
          The maximum cached bytes
 long maxSmallFileCacheSize
          The maximum cached bytes
 long minEntrySize
          The maximum size of a cached resources.
 int port
          The port used
 int secondsMaxAge
          Timeout before remove the static resource from the cache.
 
Constructor Summary
protected FileCacheFactory()
           
 
Method Summary
 ConcurrentHashMap<String,FileCache.FileCacheEntry> getCache()
          Return the FileCache
 long getCountContentHits()
          Return the Number of hits on cached file content
 long getCountContentMisses()
          Return the Number of misses on cached file content
 long getCountEntries()
          Return the number of current cache entries.
 long getCountHits()
          Return the Number of cache lookup hits
 long getCountInfoHits()
          The Number of hits on cached file info
 long getCountInfoMisses()
          Return the number of misses on cached file info
 long getCountMisses()
          Return the Number of cache lookup misses
 long getCountOpenEntries()
          The number of current open cache entries
static FileCacheFactory getFactory(int currentPort)
          Return an instance of this Factory.
 FileCache getFileCache()
          Return an instance of a FileCache
 int getFlagEnabled()
          Returns flag indicating whether file cache has been enabled
 int getHeaderBBSize()
          Retunr the header size buffer.
 boolean getLargeFileCacheEnabled()
          Is the large file cache support enabled.
 int getMaxCacheEntries()
          Return the maximum entries this cache can contains.
 long getMaxEntries()
          Return the maximum number of cache entries
 long getMaxEntrySize()
          Get the maximum size a FileCacheEntry can have.
 long getMaxHeapCacheSize()
          Return the maximum heap space used for cache
 long getMaxLargeCacheSize()
          Get the maximum cache size
 long getMaxMmapCacheSize()
          Return the Maximum Memory Map size to be used for caching
 long getMaxOpenEntries()
          Return the maximum number of open cache entries
 long getMaxSmallCacheSize()
          Get the maximum cache size
 long getMinEntrySize()
          Get the maximum size a FileCacheEntry can have.
 int getSecondsMaxAge()
          Return the maximum age of a valid cache entry
 long getSizeHeapCache()
          Return the heap space used for cache
 long getSizeMmapCache()
          Return the size of Mapped memory used for caching
static boolean isEnabled()
          Is the fileCache enabled.
static FileCacheFactory newInstance(int currentPort)
          Configure the factory.
 void setCacheManager(ConcurrentLinkedQueue<FileCache.FileCacheEntry> cacheManager)
           
 void setHeaderBBSize(int headerBBSize)
          Set the size of the header ByteBuffer.
static void setIsEnabled(boolean isE)
          Is the file caching mechanism enabled.
 void setIsMonitoringEnabled(boolean isMonitoringEnabled)
          Turn monitoring on/off
 void setLargeFileCacheEnabled(boolean isLargeEnabled)
          Is the large file cache support enabled.
 void setMaxCacheEntries(int mEntries)
          Set the maximum entries this cache can contains.
 void setMaxEntrySize(long mEntrySize)
          Set the maximum size a FileCacheEntry can have.
 void setMaxLargeCacheSize(long mCacheSize)
          Set the maximum cache size
 void setMaxSmallCacheSize(long mCacheSize)
          Set the maximum cache size
 void setMinEntrySize(long mSize)
          Set the maximum size a FileCacheEntry can have.
 void setSecondsMaxAge(int sMaxAges)
          The timeout in seconds before remove a FileCacheEntry from the fileCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

secondsMaxAge

public int secondsMaxAge
Timeout before remove the static resource from the cache.


maxCacheEntries

public int maxCacheEntries
The maximum entries in the fileCache


minEntrySize

public long minEntrySize
The maximum size of a cached resources.


maxEntrySize

public long maxEntrySize
The maximum size of a cached resources.


maxLargeFileCacheSize

public long maxLargeFileCacheSize
The maximum cached bytes


maxSmallFileCacheSize

public long maxSmallFileCacheSize
The maximum cached bytes


isEnabled

public static boolean isEnabled
Is the FileCache enabled.


isLargeFileCacheEnabled

public boolean isLargeFileCacheEnabled
Is the large FileCache enabled.


port

public int port
The port used


cache

protected static final ConcurrentHashMap<Integer,FileCacheFactory> cache
Create a factory per port.


cacheManager

protected ConcurrentLinkedQueue<FileCache.FileCacheEntry> cacheManager
The cache manager used by instance of FileCache created by this factory;


isMonitoringEnabled

protected boolean isMonitoringEnabled
Is monitoring enabled


fileCache

protected FileCache fileCache
A list of FileCache instance this Factory is owning.

Constructor Detail

FileCacheFactory

protected FileCacheFactory()
Method Detail

newInstance

public static FileCacheFactory newInstance(int currentPort)
Configure the factory.


getFactory

public static FileCacheFactory getFactory(int currentPort)
Return an instance of this Factory.


getFileCache

public FileCache getFileCache()
Return an instance of a FileCache


setCacheManager

public void setCacheManager(ConcurrentLinkedQueue<FileCache.FileCacheEntry> cacheManager)

getCache

public ConcurrentHashMap<String,FileCache.FileCacheEntry> getCache()
Return the FileCache


getFlagEnabled

public int getFlagEnabled()
Returns flag indicating whether file cache has been enabled

Returns:
1 if file cache has been enabled, 0 otherwise

getSecondsMaxAge

public int getSecondsMaxAge()
Return the maximum age of a valid cache entry

Returns:
cache entry maximum age

getCountEntries

public long getCountEntries()
Return the number of current cache entries.

Returns:
current cache entries

getMaxEntries

public long getMaxEntries()
Return the maximum number of cache entries

Returns:
maximum cache entries

getCountOpenEntries

public long getCountOpenEntries()
The number of current open cache entries

Returns:
open cache entries

getMaxOpenEntries

public long getMaxOpenEntries()
Return the maximum number of open cache entries

Returns:
maximum open cache entries

getSizeHeapCache

public long getSizeHeapCache()
Return the heap space used for cache

Returns:
heap size

getMaxHeapCacheSize

public long getMaxHeapCacheSize()
Return the maximum heap space used for cache

Returns:
maximum heap size

getSizeMmapCache

public long getSizeMmapCache()
Return the size of Mapped memory used for caching

Returns:
Mapped memory size

getMaxMmapCacheSize

public long getMaxMmapCacheSize()
Return the Maximum Memory Map size to be used for caching

Returns:
maximum Memory Map size

getCountHits

public long getCountHits()
Return the Number of cache lookup hits

Returns:
cache hits

getCountMisses

public long getCountMisses()
Return the Number of cache lookup misses

Returns:
cache misses

getCountInfoHits

public long getCountInfoHits()
The Number of hits on cached file info

Returns:
hits on cached file info

getCountInfoMisses

public long getCountInfoMisses()
Return the number of misses on cached file info

Returns:
misses on cache file info

getCountContentHits

public long getCountContentHits()
Return the Number of hits on cached file content

Returns:
hits on cache file content

getCountContentMisses

public long getCountContentMisses()
Return the Number of misses on cached file content

Returns:
missed on cached file content

setIsMonitoringEnabled

public void setIsMonitoringEnabled(boolean isMonitoringEnabled)
Turn monitoring on/off


setSecondsMaxAge

public void setSecondsMaxAge(int sMaxAges)
The timeout in seconds before remove a FileCacheEntry from the fileCache


setMaxCacheEntries

public void setMaxCacheEntries(int mEntries)
Set the maximum entries this cache can contains.


getMaxCacheEntries

public int getMaxCacheEntries()
Return the maximum entries this cache can contains.


setMinEntrySize

public void setMinEntrySize(long mSize)
Set the maximum size a FileCacheEntry can have.


getMinEntrySize

public long getMinEntrySize()
Get the maximum size a FileCacheEntry can have.


setMaxEntrySize

public void setMaxEntrySize(long mEntrySize)
Set the maximum size a FileCacheEntry can have.


getMaxEntrySize

public long getMaxEntrySize()
Get the maximum size a FileCacheEntry can have.


setMaxLargeCacheSize

public void setMaxLargeCacheSize(long mCacheSize)
Set the maximum cache size


getMaxLargeCacheSize

public long getMaxLargeCacheSize()
Get the maximum cache size


setMaxSmallCacheSize

public void setMaxSmallCacheSize(long mCacheSize)
Set the maximum cache size


getMaxSmallCacheSize

public long getMaxSmallCacheSize()
Get the maximum cache size


isEnabled

public static boolean isEnabled()
Is the fileCache enabled.


setIsEnabled

public static void setIsEnabled(boolean isE)
Is the file caching mechanism enabled.


setLargeFileCacheEnabled

public void setLargeFileCacheEnabled(boolean isLargeEnabled)
Is the large file cache support enabled.


getLargeFileCacheEnabled

public boolean getLargeFileCacheEnabled()
Is the large file cache support enabled.


getHeaderBBSize

public int getHeaderBBSize()
Retunr the header size buffer.


setHeaderBBSize

public void setHeaderBBSize(int headerBBSize)
Set the size of the header ByteBuffer.



Copyright © 2009 SUN Microsystems. All Rights Reserved.