How you handle concurrent request in java? Most of the anwser will be: Thread, Thread Pool.
But Thread, Thread Pool was native api and no any abstraction. So make you application is hard to understand and maintain. So bea, ibm and other groups join toghter define one standard and naming that with CommonJ. The CommonJ especially define one structure how to deal with async-job processing abstraction.
The main class define the interface could receive the concurrent job request.
The class could handle the concurrent job lifecycle. You can imagine that was simlar with process scheduler in the OS design.
Request composition class. So it's main containing the request parameters and other useful information.
The encapsulator class contain work, workeventlistener, etc.
The dispatch class, it will directly talking with the backend async processing engine most was thread pool.
Using the FIFO structure to store the concurrent job requests.
Could contain multiple types of queue, that mainly depends on how granularity you want to control the job lifecyle. For examples: pending, ready, pause, etc.
Define the information want to notify outside the status of the job request
Define the interface can be plugged into and can be awaring of the status of job request.
Anync Processing (Thread Pool)
The underlying language provide the async processing machanism. We leverage with java concurrent library ThreadPoolExecutor.
If contain the logic for commonj define how to pickup pipe from multiple pipes.
Figure 1: CommonJ
The standard was just a bunch of interfaces not detail implementation. And most implementor just simply implement the logics and binding with thread pool. So from scalability and throughput both cannot meet large amount concurrent job requirements.
And current most company meet the large amount concurrent job handling issues, because java thread creation has limition and distributed computing contain the complexity. So how would we do?
The possible answer could be "MultiLane CommonJ"
Next blog we will explain the internal for the multi-lane commonJ library. Please wait for that.