GC: does Observable.addObserver() create a weak or strong reference?

J

Josef Garvi

When I add an Observer to an Observable, will that produce a weak or a
strong reference? By weak, I mean a reference of the type WeakReference,
like in WeakHashMap that will not keep the GC from collecting my Observer.

--
Josef Garvi

"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/

new income - better environment - more food - less poverty
 
J

Josef Garvi

Josef said:
When I add an Observer to an Observable, will that produce a weak or a
strong reference? By weak, I mean a reference of the type WeakReference,
like in WeakHashMap that will not keep the GC from collecting my Observer.

The answer is no, as the Observable stores its Observers in a Vector, which
is strong references.

--
Josef Garvi

"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/

new income - better environment - more food - less poverty
 

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

Similar Threads

getting XPath of a node 4
Abstract interface methods? 14
What is the JMF? 5
Why generics for the Class type? 2
outer class keyword 4
what is this special syntax? 9
cloning an Observable 6
Comparables and Generics 14

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top