1000 Java Tips ebook
Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java
programming articles and tips. Please take your copy here.
Take your copy of free "Java Technology Screensaver"!.
Easy Learn Java: Programming Articles, Examples and Tips - Page 80
1060 Stories (530 Pages, 2 Per Page)
I read that an object can be strongly, weakly or even phantom (!!!!) reachable..
Question: I read that an object can be
strongly, weakly or even phantom (!!!!) reachable...
Answer: I found the definitions in API. I
think it is clear enough to be cited here:
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.
About phantom reference please read more in API
Our older tips: March 22, 2001 - October 21, 2002
All published and not published on the site tips read
30 comments | | Score: 3.33
Posted by jalex on Thursday, September 11, 2003 (00:00:00) (3506 reads)
I use logging in my application... The problem is that I am opening the PrintWri
Question: I use logging in my
application... The problem is that I am opening the
PrintWriter stream only once and keep it open until my application is stopped.
Open PrintWriter stream does not let to open logs in text editor and users can
not read logs...
Appears a error message like this: "Can not open file, it used by another
Is it possible to solve the problem?
Answer: It depends on OS type. For
example in Windows NT you can use command "type":
type log.txt > log_copy.txt and then read log_copy.txt file in any
In UNIX use command "cat":
cat log.txt > log_copy.txt
11 comments | | Score: 1
Posted by jalex on Wednesday, September 10, 2003 (00:00:00) (2874 reads)