Search code examples
multithreadingumlthreadpoolsequence-diagramcommand-pattern

How to show commands submission into thread pool in sequence diagram


I'm preparing sequence diagram. where tasks created as commands according to command design pattern are submitted into thread pool and executed.

Let's assume that command execute some methods form Data class.

And here's my problems:

I don't know if i should draw command object specifically, or just simple 'submitTask()' message passed from invoker into thread pool.

I dont't know if i should draw workerThread object, or just simplify it, to thead pool calling Data class functions.

I don't know how to represent queueing commands into thread pool, and then their executions.

I know, a lil bit chaotic, mayby the last question is the most important. Looking forward for your answers!


Solution

  • Any SD does not show any possible message combination but one single scenario. So just think which ones are most important and create the according diagrams.

    There are many, many ways to actually implement your queue. This would be some sample implementation:

    enter image description here

    Threading has two ports. One for queuing requests and one to get them out again.