Java Reference
In-Depth Information
Synchronizing Activities Executing in Parallel
Problem
You're using a <flow> to allow parallel activities to execute, but you want to synchronize
some of the executing tasks.
Solution
Define a set of <links> within the <flow> . Use their names as values for <source> and
<target> structures that will synchronize the flow based on a <joinCondition> .
Discussion
Say that you have two activities, such as invoking two separate services, that both need to
complete before some next step can begin. If you don't know which of the invocations will
complete first, you can use a link within a <flow> to express this dependency.
The elements <sources> and <targets> respectively contain <source> and <target> ele-
ments, which are used to establish a relationship for synchronizing their encapsulating activ-
ities. The relationship is defined using a <link> . Here's an example of the chiefly relevant
elements:
//...
<flow>
<links>
<link name="airplaneBooked" />
<link name="hotelBooked" />
</links>
<receive name="receiveAirReservation" ...>
<sources>
<source linkName="airplaneBooked" />
</sources>
</receive>
<receive name="receiveHotelReservation" ...>
<sources>
<source linkName="hotelBooked" />
</sources>
</receive>
<scope name="submitExpenseScope">
Search WWH ::




Custom Search