<h2>org.autoplot.datasource.ReferenceCache</h2><p>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.</p> <hr> <a name="PROP_ENABLE_REFERENCE_CACHE"></a> <h2>PROP_ENABLE_REFERENCE_CACHE</h2> <p>System property the enables the reference cache. Clients should check this before using the cache with code like: <code> boolean useReferenceCache= "true".equals( System.getProperty( ReferenceCache.PROP_ENABLE_REFERENCE_CACHE, "false" ) ); </code></p> <hr> <a name="NULL"></a> <h2>NULL</h2> <p>marker dataset used to indicate null was loaded for the URI. This dataset should not be used.</p> <hr> <a name="getDataSet"></a> <h2>getDataSet</h2> getDataSet( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> uri ) → <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/qds/QDataSet.html'>QDataSet</a> <p>Query to see if the dataset exists in the cache. Null is returned if it is not, or a QDataSet is returned if it is. NOTE: the entry might be ReferenceCache.NULL, meaning the load resulted in no data.</p> <h3>Parameters</h3> uri - the URI that can be resolved into a dataset. <h3>Returns:</h3> the dataset or null <br><br> <a href="https://github.com/autoplot/dev/search?q=getDataSet&unscoped_q=getDataSet">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/ReferenceCache.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/ReferenceCache.html#getDataSet">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/ReferenceCache.java#l199">[view source]</a> <br> <br> <hr> <a name="getDataSetOrLock"></a> <h2>getDataSetOrLock</h2> getDataSetOrLock( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> uri, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> monitor ) → <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/datasource/ReferenceCache/ReferenceCacheEntry.html'>org.autoplot.datasource.ReferenceCache.ReferenceCacheEntry</a> <p>Get a ReferenceCacheEntry for the URI, which will indicate the thread which has been designated as the load thread. <blockquote><pre><small> rcent= ReferenceCache.getInstance().getDataSetOrLock( this.tsb.getURI(), mon); if ( !rcent.shouldILoad( Thread.currentThread() ) ) { QDataSet result= rcent.park( mon ); </small></pre></blockquote> Be sure to use try/finally when using this cache!</p> <h3>Parameters</h3> uri - the URI to load. <br> monitor - to monitor the load. <h3>Returns:</h3> the ReferenceCacheEntry <br><br> <a href="https://github.com/autoplot/dev/search?q=getDataSetOrLock&unscoped_q=getDataSetOrLock">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/ReferenceCache.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/ReferenceCache.html#getDataSetOrLock">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/ReferenceCache.java#l231">[view source]</a> <br> <br> <hr> <a name="getInstance"></a> <h2>getInstance</h2> getInstance( ) → <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/datasource/ReferenceCache.html'>org.autoplot.datasource.ReferenceCache</a> <p>get the single instance of the ReferenceCache</p> <h3>Returns:</h3> an org.autoplot.datasource.ReferenceCache <br><br> <a href="https://github.com/autoplot/dev/search?q=getInstance&unscoped_q=getInstance">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/ReferenceCache.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/ReferenceCache.html#getInstance">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/ReferenceCache.java#l68">[view source]</a> <br> <br> <hr> <a name="getReferenceCacheEntry"></a> <h2>getReferenceCacheEntry</h2> getReferenceCacheEntry( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> uri ) → <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/datasource/ReferenceCache/ReferenceCacheEntry.html'>org.autoplot.datasource.ReferenceCache.ReferenceCacheEntry</a> <p>return the ReferenceCacheEntry, if any, for the URI. This is to resolve the ambiguity of the getDataSet call. Typically the status of the entry is called.</p> <h3>Parameters</h3> uri - the URI that can be resolved into a dataset. <h3>Returns:</h3> null or the ReferenceCacheEntry. <br><br> <a href="https://github.com/autoplot/dev/search?q=getReferenceCacheEntry&unscoped_q=getReferenceCacheEntry">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/ReferenceCache.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/ReferenceCache.html#getReferenceCacheEntry">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/ReferenceCache.java#l187">[view source]</a> <br> <br> <hr> <a name="offerDataSet"></a> <h2>offerDataSet</h2> offerDataSet( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> uri, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/qds/QDataSet.html'>QDataSet</a> ds ) → void <p>like putDataSet, but if no one has requested this dataset, then simply add it to the cache of datasets in case someone else wants it. Be sure to call this before the call to putDataSet that will release the lock.</p> <h3>Parameters</h3> uri - the URI <br> ds - the dataset <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=offerDataSet&unscoped_q=offerDataSet">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/ReferenceCache.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/ReferenceCache.html#offerDataSet">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/ReferenceCache.java#l334">[view source]</a> <br> <br> <hr> <a name="park"></a> <h2>park</h2> park( <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/datasource/ReferenceCache/ReferenceCacheEntry.html'>org.autoplot.datasource.ReferenceCache.ReferenceCacheEntry</a> ent, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> monitor ) → void <p>park this thread until the other guy has finished loading.</p> <h3>Parameters</h3> ent - a ReferenceCache.ReferenceCacheEntry <br> monitor - the monitor of the load. <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=park&unscoped_q=park">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/ReferenceCache.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/ReferenceCache.html#park">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/ReferenceCache.java#l269">[view source]</a> <br> <br> <hr> <a name="printStatus"></a> <h2>printStatus</h2> printStatus( ) → void <p>display the status of all the entries.</p> <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=printStatus&unscoped_q=printStatus">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/ReferenceCache.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/ReferenceCache.html#printStatus">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/ReferenceCache.java#l377">[view source]</a> <br> <br> <hr> <a name="reset"></a> <h2>reset</h2> reset( ) → void <p>explicitly remove entries from the cache.</p> <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=reset&unscoped_q=reset">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/ReferenceCache.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/ReferenceCache.html#reset">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/ReferenceCache.java#l352">[view source]</a> <br> <br> <hr> <a name="tidy"></a> <h2>tidy</h2> tidy( ) → void <p>remove all the entries that have been garbage collected.</p> <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=tidy&unscoped_q=tidy">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/ReferenceCache.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/ReferenceCache.html#tidy">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/ReferenceCache.java#l361">[view source]</a> <br> <br>