"bstansberry(a)jboss.com" wrote :
|
| | public class Key
| | {
| | private static final ReferenceQueue refQueue = new ReferenceQueue();
| |
| | private final KeyRef keyRef;
| | private final WeakReference<Annotation>[] annotations;
| |
| | public Key(Class clazz, Annotation[] annotations)
| | {
| | this.keyRef = new KeyRef(this, clazz, refQueue);
| | this.annotations = new WeakReference[annotations.length];
| | for (int j = 0; j < annotations.length; j++)
| | {
| | this.annotations[j]= new
WeakReference<Annotation>(annotations[j]);
| | }
| | }
| |
Do I really need these annotations to be wrapped in weak refs?
Wouldn't they get immediately gced?
Or if I just leave them strong, my whole Key instance will be gc candidate the moment I
nullify it in here
| while ((ref = refQueue.poll()) != null)
| {
| ((KeyRef) ref).key = null;
| }
|
since nothing else now has a strongly ref on it.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152608#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...