Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4190589

(ref) java.lang.ref.SoftReference: Add non-clearing variant

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: mr33420 Date: 11/17/98


      I am trying to use SoftReference objects to
      implement a cache which re-uses cached objects.
      I would like to use the SoftReference object
      to tell me when one of my cached objects is
      no longer strongly referenced, since then it
      is safe for me to re-use it (by creating a new
      strong reference to the object and handing it
      out to my client).

      My idea was to create a SoftReference to my
      object, register the SoftReference with a
      ReferenceQueue, and then when the SoftReference
      is queued, I could just pick up the referent and
      re-use it.

      However, according to the SoftReference API
      doc, the SoftReference is unconditionally
      cleared when it is enqueued on my ReferenceQueue,
      meaning that at that point I have no way to get
      a strong reference to my object any more.

      I need a constructor for SoftReference which
      registers it with my queue and configures it
      so that it will NOT be automatically cleared
      when queued.
      (Review ID: 42837)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            mr Mark Reinhold
            Reporter:
            mr Mark Reinhold
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: