--- Mark Proctor <[EMAIL PROTECTED]> wrote: > Looks good, I hadn't thought of that approach. I was > initially just thinking of adding > asyncAssertObject(....) to WorkingMemory interface. > My one concern with this approach is that it doesn't > use the WorkingMemory interface, meaning its not > pluggeable - could that come back to bite us?
Mattering on the objective, sure. I've got an inbetween solution. What I'm thinking is this: three basic parts, so folks can build whatever concurrent solution they desire. 1) A wrapper (ConcurrentWorkingMemory) that handles locking resources in a WorkingMemory so it can be accessed concurrently. The wrapper would implement the WorkingMemory interface. Behind the scenes it would do fine grained locking so different resources in a given WorkingMemory could be accessed concurrently. I could use some guidance on what aspects of a WorkingMemory can be safely accessed by multiple threads, but I can also spelunk the various WorkingMemoryImpl definitions to figure that out. It's also possible that the locking strategy needs to be specific to each Impl, so we may need to add a "getConcurrentWrapper()" method to the Impl. 2) A WorkingMemoryExecutor that's constructed from a ConcurrentWorkingMemory, Executor, and an AsyncStrategy. It would handle the threads used to concurrently execute the WM methods. This would be substantially similar to the example I've already posted. The AsyncStrategy would describe when to invoke fireAllRules, and other asynchronous behaviors. The WorkingMemoryExecutor could also implement the WorkingMemory interface. 3) Some premade examples of usage. For example, the code I've already posted implements "single thread of execution with guaranteed order" behavior. We should also make a "thread pool with no guaranteed order" example. > I just with my concurrency desing skills were > stronger :( It's soooo fun to learn. :) I suggest the O'Reilly threads book as a good start. Also "Java Concurrency in Practice" is coming out in June, with Joshua Bloch and Doug Lee among the authors. It oughtta be awesome. :) GreG __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
