Parallel Processing

From WebLab Wiki
Jump to navigationJump to search

In order to speed up the construction of a Resource, we can parallelise the execution of differents services on the same resource, but if we want to merge the information obtained on each parallel process, we have to use a merger at the end of the parallel processings.


The resources-merger is a library (jar) which can be use in your project, especially if your chain is made using java, or wrapped in a web services, or any way you want, it's a library.

How to use it

You can add the library in your dependencies manually or using maven :


How does it work

In order to merge the information, the resources-merger need to know the state before the parallel split, and every final state of each parallel branch. The merger can then be launch using one of the 2 merge function :

  • merge(beforeSplitResource, Branch_1, Branch_2, ..., Branch_n)
  • merge(beforeSplitResource, List<Branch>)


Here is two examples of how to use this tool :

Resource splitResource;
List<Resource> resources;
Resource result = ResourcesMerger.getInstance().merge(splitResource, resources);
Resource splitResource;
Resource resource1;
Resource resource2;
Resource result = ResourcesMerger.getInstance().merge(splitResource, resource1, resource2);