What is a hard link in java?

When I was studying perggen, I came across the term "hard link". I do not know what is meant by hard link. Can someone explain or give me some lessons about this, please?

+6
source share
3 answers

Hard links are normal links, that is, variables, unlike subclasses of java.lang.ref.Reference , phantom, soft, and weak links.

+2
source

A strong (solid) link is a link that tells the garbage collector not to touch this object (how, but not deleting it from memory).

Any object accessible via strong links from the root garbage collector (temporary variables on the stack (of any thread), static variables (from any class) and special links from JNI's own code) will be kept alive. Strong links are normal links.

Soft links, Weak links and Phantom links are not cleared by the garbage collector during cleaning (this is not entirely true, since Soft links are kept for some time). Any object accessible only to weak references can be cleared at runtime of your program, and these links can return null at any moment of time. Instead of strong links, you need to make a referenceobject to use these types of links.

For more information on soft, weak, and phantom links, see this document .

+1
source

Source: https://habr.com/ru/post/892483/


All Articles