File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes I Though That I Knew What Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "I Though That I Knew What "reachable" Meant" Watch "I Though That I Knew What "reachable" Meant" New topic

I Though That I Knew What "reachable" Meant

Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

I thought that an object was either "reachable" or "not-reachable". I ran across the term "weakly-reachable", but I don't understand the different kinds of reachability. Will somebody explain these for me?

Reachabilty As Explained in the API JavaDoc

Going from strongest to weakest, the different levels of reachability reflect the life cycle of an object. They are operationally defined as follows:

* An object is strongly reachable if it can be reached by some thread without traversing any reference objects. A newly-created object is strongly reachable by the thread that created it.
* An object is softly reachable if it is not strongly reachable but can be reached by traversing a soft reference.
* An object is weakly reachable if it is neither strongly nor softly reachable but can be reached by traversing a weak reference. When the weak references to a weakly-reachable object are cleared, the object becomes eligible for finalization.
* An object is phantom reachable if it is neither strongly, softly, nor weakly reachable, it has been finalized, and some phantom reference refers to it.
* Finally, an object is unreachable, and therefore eligible for reclamation, when it is not reachable in any of the above ways.
amitabh mehra
Ranch Hand

Joined: Dec 05, 2006
Posts: 98
try this link:
which explains the strong/weak/soft/phantom references...
I agree. Here's the link:
subject: I Though That I Knew What "reachable" Meant
It's not a secret anymore!