< prev index next >

src/java.desktop/share/classes/sun/applet/AppletImageRef.java

Print this page




  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.applet;
  27 
  28 import java.awt.Toolkit;
  29 import java.awt.Image;
  30 import java.lang.ref.SoftReference;
  31 import sun.awt.image.URLImageSource;
  32 import java.net.URL;
  33 

  34 class AppletImageRef {
  35     private SoftReference<Image> soft = null;
  36 
  37     URL url;
  38 
  39     /**
  40      * Returns a pointer to the object referenced by this Ref.  If the object
  41      * has been thrown away by the garbage collector, it will be
  42      * reconstituted. This method does everything necessary to ensure that the garbage
  43      * collector throws things away in Least Recently Used(LRU) order.  Applications should
  44      * never override this method. The get() method effectively caches calls to
  45      * reconstitute().
  46      */
  47     public synchronized Image get() {
  48         Image t = check();
  49         if (t == null) {
  50             t = reconstitute();
  51             setThing(t);
  52         }
  53         return t;




  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.applet;
  27 
  28 import java.awt.Toolkit;
  29 import java.awt.Image;
  30 import java.lang.ref.SoftReference;
  31 import sun.awt.image.URLImageSource;
  32 import java.net.URL;
  33 
  34 @Deprecated(since = "9")
  35 class AppletImageRef {
  36     private SoftReference<Image> soft = null;
  37 
  38     URL url;
  39 
  40     /**
  41      * Returns a pointer to the object referenced by this Ref.  If the object
  42      * has been thrown away by the garbage collector, it will be
  43      * reconstituted. This method does everything necessary to ensure that the garbage
  44      * collector throws things away in Least Recently Used(LRU) order.  Applications should
  45      * never override this method. The get() method effectively caches calls to
  46      * reconstitute().
  47      */
  48     public synchronized Image get() {
  49         Image t = check();
  50         if (t == null) {
  51             t = reconstitute();
  52             setThing(t);
  53         }
  54         return t;


< prev index next >