[jboss-dev-forums] [JBoss Microcontainer Development] - Re: Optimizing ControllerState
alesj
do-not-reply at jboss.com
Wed Oct 14 12:02:54 EDT 2009
"adrian at jboss.org" wrote : The whole point is that you're supposed to be able to add/interpolate new states.
|
Sure, but that doesn't mean we should to create 2M immutable instances where only a hand full of them differ.
Not to mention huge contention on equals/hashCode.
Having some synched registry of those immutable instances,
who's equals/hashCode impl is O(1) op is what we need.
"adrian at jboss.org" wrote :
| The real problem is using an ad hoc shared list of states and having to find out where in
| the list you are everytime, i.e. are you trying to transistion to before
| or after the current state.
|
| Like we've discussed before, this logic goes away if you specify what
| transistions/path the context should go through.
| https://jira.jboss.org/jira/browse/JBKERNEL-48
|
| The only hard part is for backwards comapbility you've got to generate a path
| from the legacy shared states when somebody invokes
|
| change(ControllerContext, newControllerState);
|
| and similar for install() if the ControllerMode is AUTOMATIC.
|
| So I'd spend my time on JBKERNEL-48 rather than trying to fix the before/after
| stuff that is going to go away anyway.
I definitely agree JBKERNEL-48 is what we should have at the end,
but this doesn't change the fact that we need to change the actual
ControllerState impl to be a lot more optimal - instance # and compareTo.
CompareTo is, like you already mentioned, trickier with more generic transitions/path.
It might not even be able to compare, but that would mostly come from abusing api (e.g. wrong usage).
But still the new impl shouldn't be as slow as states.indexOf is/was,
some additional data/computation can easily be executed,
specially with limited number of instances flowing around.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4260350#4260350
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4260350
More information about the jboss-dev-forums
mailing list