Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > GC: does Observable.addObserver() create a weak or strong reference?

Reply
Thread Tools

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

 
 
Josef Garvi
Guest
Posts: n/a
 
      05-27-2004
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
 
Reply With Quote
 
 
 
 
Josef Garvi
Guest
Posts: n/a
 
      05-27-2004
Josef Garvi wrote:
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Are weak refs slower than strong refs? John Nagle Python 3 02-25-2007 08:54 PM
Compilation fails when a windows form user control is assigned a strong name but it refers to an activex control which does not have strong name ashish_gokhale ASP .Net Web Controls 0 05-05-2005 01:38 PM
What are Weak Unknown, Weak Zero and Weak 1? Kuan Zhou VHDL 1 01-24-2005 12:57 PM
strong/weak typing and pointers Gabriel Zachmann Python 102 11-13-2004 01:45 AM
Strong types (.NET) versus weak types (Python) j_mckitrick Python 2 11-13-2004 01:08 AM



Advertisments