javawebsphereworkmanagers

Websphere WorkManager


I am using a commonj.work.WorkManager to process a few queries in parallel. I have a series of dao classes implementing an interface, and have an implementation of Work that executes the methods in the run method. With this set up, I am able to return data as I would expect with the work API.

I am now trying to handle error situations: -Exception encountered in dao -queries take longer than waitForAll allows

I noticed that WorkItem.getResult returns null for queries that are still processing. I still have instances to dao objects in an ArrayList, so I can get parameters and settings from there. It does seem like I should be able to get this from the WorkItem though, is there a better way?

Also, the only way I have been able to get at the Exception thrown would be to store it in the class that implements Work and provide an accessor method for it. Again, i feel there must be a better way.

This is running on websphere 6.1 without the EJB 3, WS feature pack (so no Java EE 5).


Solution

  • although the question is a year old, i wanted to provide an update in the event anyone comes across this question. my classes that implement Work have a member attribute that will store the Exception. I was thinking that this was going to be an issue, but it actually has worked out quite well. Any exception thrown in a threaded call shouldn't affect any other threads that are running, when all work is completed i evaluate the exceptions and take action depending on the issue.