stateless or not

F

Franz Bayer

Then the object is garbagecollected and leaves just a copy, if no other
reference occurs.

My question though related just to EJBs.
I think after this short discussion, that a state non-existent means, the
bean-class exixts but no instance of a this bean "lives" in the container.

/franz
 
L

lawrence

Thomas G. Marshall said:
That only says that state can be stored elsewhere (in this case, in the
class statics themselves). It says nothing of the state of a non-existent
object


Whoa. I don't know much about Java, but is this right? Are you saying
a class can be garbage collected, yet its static variables remain in
memory? Why would the VJM not reclaim a private static variable that
can't be reached after the object has been destroyed?
 
M

Michael Borgwardt

lawrence wrote
Whoa. I don't know much about Java, but is this right? Are you saying
a class can be garbage collected, yet its static variables remain in
memory?

*instances* of the class (i.e. objects) are garbage collected, not the
class itself. And since the static variables are a property of the
class and not a particular object, they remain.

Classes can only be garbage collected under rather rare circumstances
(and not at all if they were loaded through the boot class loader).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top