Websphere工作管理器
我正在使用 commonj.work.WorkManager 并行处理一些查询。我有一系列实现接口的 dao 类,并且有一个执行 run 方法中的方法的 Work 实现。通过此设置,我可以按照工作 API 的预期返回数据。
我现在正在尝试处理错误情况: -dao中遇到异常 - 查询花费的时间比 waitForAll 允许的时间长
我注意到 WorkItem.getResult 对于仍在处理的查询返回 null。我仍然在 ArrayList 中拥有 dao 对象的实例,因此我可以从那里获取参数和设置。看来我应该能够从 WorkItem 中获取它,有更好的方法吗?
另外,我能够获取抛出的异常的唯一方法是将其存储在实现 Work 的类中并为其提供访问器方法。我再次觉得必须有更好的方法。
它在没有 EJB 3、WS 功能包的 websphere 6.1 上运行(因此没有 Java EE 5)。
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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尽管这个问题已经存在一年了,但我想在有人遇到这个问题时提供更新。我实现 Work 的类有一个用于存储异常的成员属性。我本来以为这会是一个问题,但实际上效果很好。线程调用中引发的任何异常不应影响正在运行的任何其他线程,当所有工作完成后,我会评估异常并根据问题采取措施。
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.