Provide a cache of datasets that are in memory, so that the same data is not loaded twice. This first implementation uses WeakReferences, so that this cache need not be emptied, but we will avoid the situation where the same data is loaded twice.
Get a ReferenceCacheEntry for the URI, which will indicate the thread which has been designated as the load thread.
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!
park this thread until the other guy has finished loading.
put the dataset into the ReferenceCache. If it is mutable, then a copy is made.
remove all the entries that have been garbage collected.