|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opends.server.api.EntryCache<FileSystemEntryCacheCfg>
org.opends.server.extensions.FileSystemEntryCache
public class FileSystemEntryCache
This class defines a Directory Server entry cache that uses JE database to
keep track of the entries. Intended use is when JE database resides in the
memory based file system which has obvious performance benefits, although
any file system will do for this cache to function. Entries are maintained
either by FIFO (default) or LRU (configurable) based list implementation.
Cache sizing is based on the size of free space available in the file
system, such that if enough memory is free, then adding an entry to the
cache will not require purging, but if more than a specified size of the
file system available space is already consumed, then one or more entries
will need to be removed in order to make room for a new entry. It is also
possible to configure a maximum number of entries for the cache. If this
is specified, then the number of entries will not be allowed to exceed
this value, but it may not be possible to hold this many entries if the
available memory fills up first.
Other configurable parameters for this cache include the maximum length of
time to block while waiting to acquire a lock, and a set of filters that may
be used to define criteria for determining which entries are stored in the
cache. If a filter list is provided, then only entries matching at least
one of the given filters will be stored in the cache.
JE environment cache size can also be configured either as percentage of
the free memory available in the JVM or as explicit size in bytes.
This cache has a persistence property which, if enabled, allows for the
contents of the cache to stay persistent across server or cache restarts.
Field Summary |
---|
Fields inherited from class org.opends.server.api.EntryCache |
---|
cacheHits, cacheMisses |
Constructor Summary | |
---|---|
FileSystemEntryCache()
Creates a new instance of this entry cache. |
Method Summary | |
---|---|
ConfigChangeResult |
applyConfigurationChange(FileSystemEntryCacheCfg configuration)
Applies the configuration changes to this change listener. |
void |
clear()
Removes all entries from the cache. |
void |
clearBackend(Backend backend)
Removes all entries from the cache that are associated with the provided backend. |
void |
clearSubtree(DN baseDN)
Removes all entries from the cache that are below the provided DN. |
boolean |
containsEntry(DN entryDN)
Indicates whether the entry cache currently contains the entry with the specified DN. |
void |
finalizeEntryCache()
Performs any necessary cleanup work (e.g., flushing all cached entries and releasing any other held resources) that should be performed when the server is to be shut down or the entry cache destroyed or replaced. |
java.lang.Long |
getCacheCount()
Retrieves the current number of entries stored within the cache. |
Entry |
getEntry(DN entryDN)
Retrieves the entry with the specified DN from the cache. |
DN |
getEntryDN(Backend backend,
long entryID)
Retrieves the entry DN for the entry with the specified ID on the specific backend from the cache. |
long |
getEntryID(DN entryDN)
Retrieves the entry ID for the entry with the specified DN from the cache. |
java.util.ArrayList<Attribute> |
getMonitorData()
Retrieves a set of attributes containing monitor data that should be returned to the client if the corresponding monitor entry is requested. |
void |
handleLowMemory()
Attempts to react to a scenario in which it is determined that the system is running low on available memory. |
void |
initializeEntryCache(FileSystemEntryCacheCfg configuration)
Initializes this entry cache implementation so that it will be available for storing and retrieving entries. |
boolean |
isConfigurationAcceptable(EntryCacheCfg configuration,
java.util.List<Message> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this entry cache. |
boolean |
isConfigurationChangeAcceptable(FileSystemEntryCacheCfg configuration,
java.util.List<Message> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener. |
boolean |
processEntryCacheConfig(FileSystemEntryCacheCfg configuration,
boolean applyChanges,
EntryCacheCommon.ConfigErrorHandler errorHandler)
Parses the provided configuration and configure the entry cache. |
void |
putEntry(Entry entry,
Backend backend,
long entryID)
Stores the provided entry in the cache. |
boolean |
putEntryIfAbsent(Entry entry,
Backend backend,
long entryID)
Stores the provided entry in the cache only if it does not conflict with an entry that already exists. |
protected boolean |
removeEldestEntry(java.util.Map.Entry eldest)
This method is called each time we add a new key/value pair to the map. |
void |
removeEntry(DN entryDN)
Removes the specified entry from the cache. |
Methods inherited from class org.opends.server.api.EntryCache |
---|
filtersAllowCaching, getCacheHits, getCacheMisses, getEntry, getEntry, getEntryCacheMonitor, getExcludeFilters, getIncludeFilters, getLockTimeout, setEntryCacheMonitor, setExcludeFilters, setIncludeFilters, setLockTimeout |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileSystemEntryCache()
Method Detail |
---|
public void initializeEntryCache(FileSystemEntryCacheCfg configuration) throws ConfigException, InitializationException
initializeEntryCache
in class EntryCache<FileSystemEntryCacheCfg>
configuration
- The configuration to use to initialize
the entry cache.
ConfigException
- If there is a problem with the provided
configuration entry that would prevent
this entry cache from being used.
InitializationException
- If a problem occurs during the
initialization process that is
not related to the
configuration.public void finalizeEntryCache()
finalizeEntryCache
in class EntryCache<FileSystemEntryCacheCfg>
public boolean containsEntry(DN entryDN)
containsEntry
in class EntryCache<FileSystemEntryCacheCfg>
entryDN
- The DN for which to make the determination.
true
if the entry cache currently contains the
entry with the specified DN, or false
if not.public Entry getEntry(DN entryDN)
getEntry
in class EntryCache<FileSystemEntryCacheCfg>
entryDN
- The DN of the entry to retrieve.
null
if it is not present.public long getEntryID(DN entryDN)
getEntryID
in class EntryCache<FileSystemEntryCacheCfg>
entryDN
- The DN of the entry for which to retrieve the
entry ID.
public DN getEntryDN(Backend backend, long entryID)
getEntryDN
in class EntryCache<FileSystemEntryCacheCfg>
backend
- The backend associated with the entry for
which to retrieve the entry DN.entryID
- The entry ID within the provided backend
for which to retrieve the entry DN.
null
if it is not present in the cache.public void putEntry(Entry entry, Backend backend, long entryID)
putEntry
in class EntryCache<FileSystemEntryCacheCfg>
entry
- The entry to store in the cache.backend
- The backend with which the entry is associated.entryID
- The entry ID within the provided backend that
uniquely identifies the specified entry.public boolean putEntryIfAbsent(Entry entry, Backend backend, long entryID)
putEntryIfAbsent
in class EntryCache<FileSystemEntryCacheCfg>
entry
- The entry to store in the cache.backend
- The backend with which the entry is associated.entryID
- The entry ID within the provided backend that
uniquely identifies the specified entry.
false
if an existing entry or some other problem
prevented the method from completing successfully, or
true
if there was no conflict and the entry was
either stored or the cache determined that this entry
should never be cached for some reason.public void removeEntry(DN entryDN)
removeEntry
in class EntryCache<FileSystemEntryCacheCfg>
entryDN
- The DN of the entry to remove from the cache.public void clear()
clear
in class EntryCache<FileSystemEntryCacheCfg>
public void clearBackend(Backend backend)
clearBackend
in class EntryCache<FileSystemEntryCacheCfg>
backend
- The backend for which to flush the associated
entries.public void clearSubtree(DN baseDN)
clearSubtree
in class EntryCache<FileSystemEntryCacheCfg>
baseDN
- The base DN below which all entries should be
flushed.public void handleLowMemory()
handleLowMemory
in class EntryCache<FileSystemEntryCacheCfg>
public boolean isConfigurationAcceptable(EntryCacheCfg configuration, java.util.List<Message> unacceptableReasons)
isConfigurationAcceptable
in class EntryCache<FileSystemEntryCacheCfg>
configuration
- The entry cache configuration for
which to make the determination.unacceptableReasons
- A list that may be used to hold the
reasons that the provided
configuration is not acceptable.
true
if the provided configuration is acceptable
for this entry cache, or false
if not.public boolean isConfigurationChangeAcceptable(FileSystemEntryCacheCfg configuration, java.util.List<Message> unacceptableReasons)
isConfigurationChangeAcceptable
in interface ConfigurationChangeListener<FileSystemEntryCacheCfg>
configuration
- The new configuration containing the changes.unacceptableReasons
- A list that can be used to hold messages about why the
provided configuration is not acceptable.
true
if the proposed change is
acceptable, or false
if it is not.public ConfigChangeResult applyConfigurationChange(FileSystemEntryCacheCfg configuration)
applyConfigurationChange
in interface ConfigurationChangeListener<FileSystemEntryCacheCfg>
configuration
- The new configuration containing the changes.
public boolean processEntryCacheConfig(FileSystemEntryCacheCfg configuration, boolean applyChanges, EntryCacheCommon.ConfigErrorHandler errorHandler)
configuration
- The new configuration containing the changes.applyChanges
- If true then take into account the new configuration.errorHandler
- An handler used to report errors.
true
if configuration is acceptable,
or false
otherwise.public java.util.ArrayList<Attribute> getMonitorData()
getMonitorData
in class EntryCache<FileSystemEntryCacheCfg>
public java.lang.Long getCacheCount()
getCacheCount
in class EntryCache<FileSystemEntryCacheCfg>
protected boolean removeEldestEntry(java.util.Map.Entry eldest)
eldest
- The least recently inserted entry in the map, or if
this is an access-ordered map, the least recently
accessed entry. This is the entry that will be
removed it this method returns true. If the map was
empty prior to the put or putAll invocation resulting
in this invocation, this will be the entry that was
just inserted; in other words, if the map contains a
single entry, the eldest entry is also the newest.
true
if the eldest entry should be removed
from the map; false
if it should be retained.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |