浏览 1719 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2009-01-20
最后修改:2009-01-31
jWorkPool HomePage I have ever met a problem that Lucene would lock the files of index when we do writing actions, so in a multi-`thread environment, if we only apply traditional Java Asynchronized keyword for sharing this mutex resource, the effect of index writing would be lower. For that, we introduced JSR166 (JDK1.5 java.util.concurrent) Lea 1999 into our project. Indeed, personally, I capsulated this framework with Spring as my own framework jWorkPool 6 for my mates at first. As my plan, a multi-thread oriented work process is cut into several Work Services by their function and the mutex resources that them accesses, moreover each Work Service has its defined Work Pool for running. Programmers could configure the size of Work Pool to control and optimize the mutex resources' sharing. For example, we use Fixed-Single-Workpool to run the work services for Lucene index writing, only one work service can run in the pool while other submitted work services are waiting in the waiting list. I also design SessionContext, each of which contains variables of a work process among a series of services, and maintain the state of work process. In additional, each service has its "next" service which is injected into service by Spring IoC, and stands for the next service to invoke in process. An abstract class "Router" is defined as a special kind of service which could cipher out what's to do next by variables in SessionContext, and control the process. What's more, the most exciting character of jWorkPool is that Work Services and Work Pool I mentioned above need only configure in Spring Beans XML. That means Beans XML can present the work processes just like BPEL. For more information about this kit please check the homepage of project. Finally we implement the whole business logic in Work Services, and applying jWorkPool shows us a higher performance. Semantic web tech 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |