1 Reply Latest reply: Sep 21, 2010 5:31 AM by David Bosschaert RSS

Less synchronization on AbstractBundle.registeredServices/usedServices?

David Bosschaert Expert

I looked at the synchronization of AbstractBundle.registeredServices and AbstractBundle.usedServices and think that we can possibly get rid of the synchronization on these if we eagerly initialize the fields, thereby taking advantage of the concurrency features of the CopyOnWriteArrayList and ConcurrentHashMap.

 

It put it on the reg_svc_in_use branch, see here: http://github.com/jbosgi/jbosgi-container/commit/3e5437af79b56eec1ae61bd5c2d4881fa3046b3f

 

WRT to the cost of eagerly initializing the CopyOnWriteArrayList: it's extremely fast.

Constructing a ConcurrentHashMap is a little more involved, but I think it will also be quite fast, probably unnoticable so (I guess running a profiler will tell us for sure about that)...

 

Anyway - thoughts anyone on the suggested branch?