[jboss-dev-forums] [JBoss Microcontainer Development] - Re: Optimizing ControllerState

kabir.khan@jboss.com do-not-reply at jboss.com
Fri Oct 30 10:48:02 EDT 2009


I have committed the optimized controller state model and updated AbstractController to use it.
[url[https://jira.jboss.org/jira/browse/JBKERNEL-57[/url]

I removed ControllerStateModel from AbstractController's interfaces and removed the methods. The new ControllerStateModel lives here:
https://svn.jboss.org/repos/jbossas/projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/MapControllerStateModel.java 
and the legacy one lives here"
https://svn.jboss.org/repos/jbossas/projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/ListControllerStateModel.java

"kabir" wrote : 
  | One minor issue is the iterator() and listIterator() methods, which are not thread safe at the moment. The other methods are called with a lock taken in AbstractController. For the iterator methods I need to readLock, take a snapshot into a list and return iterators to that list.
  | 

This was wrong, although AbstractController holds locks when accessing the states, others may use it without locks taken, e.g.

  | controller.getStates.isAfterState(state1, state2)
  | 
Since MapControllerStateModel keeps tracks of a few different things (as opposed to ListControllerStateModel which is backed by a single concurrent list), I am unsure whether read/write locks should be used there. I am pretty sure that the way I have set it up, it should be safe to use, but you might want to review this. In any case having read/write locks in MapCSM should still outperform ListCSM although I haven't actually measured that. I'll check that if consensus is that MapCSM needs locks


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

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



More information about the jboss-dev-forums mailing list