[kepler-dev] Can "stop" interrupt "initialize()"

Kevin Ruland kruland at ku.edu
Wed Feb 1 12:14:55 PST 2006

Edward A. Lee wrote:
> At 11:22 AM 2/1/2006 -0600, Kevin Ruland wrote:
>> 1) Should CompositeActor release the read-lock prior to making the open
>> call to the director's preinitialize()?
> This would have to be done very carefully.
> If you don't hold a read lock, then the structure of the model
> can change at any time.  If you are iterating through a list of actors
> to preinitialize them, for example, and the list of actors changes
> while you are iterating through it, you could get into trouble.
> The "right" way to mutate the model is by queueing a ChangeRequest.
> Edward


I think I'm in a big pickle right now.  In my local copy of 
CompositeActor, I moved the getDirector().preinitialize() to outside the 
finally block which releases the read lock.  This did not fix the issue 
I'm having so I suspect the problem is much deeper.  So looking back up 
the call stack, I see that Manager.initialize() also gets the Read 
Lock.  Since Workspace's read lock is reentrant that isn't a problem -- 
it just indicates to me there is something catastrophically wrong with 
the actor I have in hand.

So, I'm going down the ChangeRequest route.  The interface is pretty 
straight forward especially since I can just use anonymous 
implementations.  My big question is what changes need to be through a 
ChangeRequest and if there are any exceptions, e.g. When I'm in an 
attributeChanged() method, do I need to queue a ChangeRequest?  Feel 
free to just point me to the documentation.

I just tried it - and it completely fixed the problem!

Thanks much for your time.


More information about the Kepler-dev mailing list