[jboss-dev-forums] [Design the new POJO MicroContainer] - Experimental notion of attachments for types

adrian@jboss.org do-not-reply at jboss.com
Thu Feb 1 10:44:00 EST 2007


I've introduced an experimental notion of attachments for types in the TypeInfo api.

This allows for easier caching of information related to a type.

It also means that when we introduce a better caching mechanism than the
WeakTypeCache we can control better what gets flushed from memory because
it is not being used.

My one concern is that this information is public so it would probably need
a security permission to allow modifcation.

Given that concern, it might be better to just use a more normal

  | WeakHashMap<TypeInfo, WeakReference<ObjectCached>>
  | 
where you want to do caching instead?

But the internal weak hashmap doesn't allow the information to be shared as easily
and it means ugly handling of the WeakReferences.

Also multiple WeakReferences for each cached object is something that
really stresses the GC.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009491#4009491

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009491



More information about the jboss-dev-forums mailing list