T - public abstract class AbstractIndexCache<T extends IRangeQuery> extends Object
IIndex like objects. A
canonicalizing cache is used with weak references to the IIndexs
back by a hard reference LRU cache. This tends to keep around views that
are reused while letting references for unused views be cleared by the
garbage collector in a timely manner.| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.log4j.Logger |
log |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractIndexCache(int capacity,
long timeout) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
dropIndexFromCache(String name)
Drop the
ITx.UNISOLATED and ITx.READ_COMMITTED
entries for the named index from the cache. |
T |
getIndex(String name,
long timestamp)
Request a view of an index.
|
protected abstract T |
newView(String name,
long timestamp)
Method is invoked on a cache miss and returns a view of the described
index.
|
protected void |
shutdown() |
protected AbstractIndexCache(int capacity,
long timeout)
capacity - The capacity of the backing LRU hard reference cache.timeout - The timeout in milliseconds for stale entries in the cache.IBigdataClient.Options.CLIENT_INDEX_CACHE_CAPACITY,
IBigdataClient.Options.CLIENT_INDEX_CACHE_TIMEOUTprotected abstract T newView(String name, long timestamp)
name - timestamp - null if the described index
does not exist.public T getIndex(String name, long timestamp)
Note: ITx.READ_COMMITTED views are cached. Read-committed
semantics are obtained by the indirection imposed by the
IClientIndex, which converts a request by the client into a
request against the appropriate IDataServices via task(s)
submitted against those services.
name - The index name.timestamp - The timestamp of the view.null if the described index
does not exist.protected void dropIndexFromCache(String name)
ITx.UNISOLATED and ITx.READ_COMMITTED
entries for the named index from the cache.
Historical and transactional reads are still allowed, but we remove the read-committed or unisolated views from the cache once the index has been dropped. If a client wants them, it needs to re-request. If they have been re-registered on the metadata service then they will become available again.
Note: Operations against unisolated or read-committed indices will throw exceptions if they execute after the index was dropped.
protected void shutdown()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.