|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opends.server.api.EntryCache<FIFOEntryCacheCfg>
org.opends.server.extensions.FIFOEntryCache
public class FIFOEntryCache
This class defines a Directory Server entry cache that uses a FIFO to keep
track of the entries. Entries that have been in the cache the longest are
the most likely candidates for purging if space is needed. In contrast to
other cache structures, the selection of entries to purge is not based on
how frequently or recently the entries have been accessed. This requires
significantly less locking (it will only be required when an entry is added
or removed from the cache, rather than each time an entry is accessed).
Cache sizing is based on the percentage of free memory within the JVM, such
that if enough memory is free, then adding an entry to the cache will not
require purging, but if more than a specified percentage of the available
memory within the JVM 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.
Field Summary |
---|
Fields inherited from class org.opends.server.api.EntryCache |
---|
cacheHits, cacheMisses |
Constructor Summary | |
---|---|
FIFOEntryCache()
Creates a new instance of this FIFO entry cache. |
Method Summary | |
---|---|
ConfigChangeResult |
applyConfigurationChange(FIFOEntryCacheCfg 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(FIFOEntryCacheCfg 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(FIFOEntryCacheCfg configuration,
java.util.List<Message> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener. |
boolean |
processEntryCacheConfig(FIFOEntryCacheCfg 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. |
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 FIFOEntryCache()
Method Detail |
---|
public void initializeEntryCache(FIFOEntryCacheCfg configuration) throws ConfigException, InitializationException
initializeEntryCache
in class EntryCache<FIFOEntryCacheCfg>
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<FIFOEntryCacheCfg>
public boolean containsEntry(DN entryDN)
containsEntry
in class EntryCache<FIFOEntryCacheCfg>
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<FIFOEntryCacheCfg>
entryDN
- The DN of the entry to retrieve.
null
if it is not present.public long getEntryID(DN entryDN)
getEntryID
in class EntryCache<FIFOEntryCacheCfg>
entryDN
- The DN of the entry for which to retrieve the
entry ID.
public DN getEntryDN(Backend backend, long entryID)
getEntryDN
in class EntryCache<FIFOEntryCacheCfg>
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<FIFOEntryCacheCfg>
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<FIFOEntryCacheCfg>
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<FIFOEntryCacheCfg>
entryDN
- The DN of the entry to remove from the cache.public void clear()
clear
in class EntryCache<FIFOEntryCacheCfg>
public void clearBackend(Backend backend)
clearBackend
in class EntryCache<FIFOEntryCacheCfg>
backend
- The backend for which to flush the associated
entries.public void clearSubtree(DN baseDN)
clearSubtree
in class EntryCache<FIFOEntryCacheCfg>
baseDN
- The base DN below which all entries should be
flushed.public void handleLowMemory()
handleLowMemory
in class EntryCache<FIFOEntryCacheCfg>
public boolean isConfigurationAcceptable(EntryCacheCfg configuration, java.util.List<Message> unacceptableReasons)
isConfigurationAcceptable
in class EntryCache<FIFOEntryCacheCfg>
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(FIFOEntryCacheCfg configuration, java.util.List<Message> unacceptableReasons)
isConfigurationChangeAcceptable
in interface ConfigurationChangeListener<FIFOEntryCacheCfg>
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(FIFOEntryCacheCfg configuration)
applyConfigurationChange
in interface ConfigurationChangeListener<FIFOEntryCacheCfg>
configuration
- The new configuration containing the changes.
public boolean processEntryCacheConfig(FIFOEntryCacheCfg 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<FIFOEntryCacheCfg>
public java.lang.Long getCacheCount()
getCacheCount
in class EntryCache<FIFOEntryCacheCfg>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |