public class ReferenceCache
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ReferenceCache.ReferenceCacheEntry
Keep track of the status of a load.
|
static class |
ReferenceCache.ReferenceCacheEntryStatus |
| Modifier and Type | Method and Description |
|---|---|
QDataSet |
getDataSet(java.lang.String uri)
Query to see if the dataset exists in the cache.
|
ReferenceCache.ReferenceCacheEntry |
getDataSetOrLock(java.lang.String uri,
ProgressMonitor monitor)
Get a ReferenceCacheEntry for the URI, which will indicate the thread which has been designated as the load thread.
|
static ReferenceCache |
getInstance()
get the single instance of the ReferenceCache
|
void |
park(ReferenceCache.ReferenceCacheEntry ent,
ProgressMonitor monitor)
park this thread until the other guy has finished loading.
|
void |
printStatus()
display the status of all the entries.
|
void |
putDataSet(java.lang.String uri,
QDataSet ds)
put the dataset into the ReferenceCache.
|
void |
reset()
explicitly remove entries from the cache.
|
void |
tidy()
remove all the entries that have been garbage collected.
|
public static ReferenceCache getInstance()
public QDataSet getDataSet(java.lang.String uri)
uri - the URI that can be resolved into a dataset.public ReferenceCache.ReferenceCacheEntry getDataSetOrLock(java.lang.String uri, ProgressMonitor monitor)
rcent= ReferenceCache.getInstance().getDataSetOrLock( this.tsb.getURI(), mon);
if ( !rcent.shouldILoad( Thread.currentThread() ) ) {
QDataSet result= rcent.park( mon );
}
Be sure to use try/finally when using this cache!uri - the URI to load.monitor - to monitor the load.public void park(ReferenceCache.ReferenceCacheEntry ent, ProgressMonitor monitor)
ent - monitor - the monitor of the load.public void putDataSet(java.lang.String uri,
QDataSet ds)
uri - ds - public void reset()
public void tidy()
public void printStatus()