In Tibco Designer we can draw parallel transitions, but how are they executed? In parallel? The answer is: no, not quite. Let's create a simple process printing to console Thread.currentThread()+"@"+System.currentTimeMillis() before and after calling HTTP request reply and put it 9 times in different transitions. We see that all activities before HTTP are executed sequentially by the same JobCourier thread and all activities after HTTP are executed by another thread from JobPool, the same for all 9 calls. Please notice that HTTP call is not performed inline. It is executed by dedicated thread pool different than Engine.ThreadCount pool. After the work is queued the process is suspended and its JobCourier is returned to the pool. When HTTP is done Engine seeks for the first unused (round robin) JobCourier thread and resumes main process. Dedicated thread pool is the place where multithreading is utilized.
Let's try to replace HTTP call with plain Sleep, parameterized with integer from 1 to 1000. We see that Sleep in not performed inline. Thread is taken away from process and then returned. Even Sleep(1ms) causes thread switch.
0 komentarze:
Prześlij komentarz