I can use the methods split
or newChild
to create a child for a SubMonitor [1]:
SubMonitor firstChild = parentMonitor.split(50);
SubMonitor secondChild = parentMonitor.split(50);
The creation of the second child automatically finishes the first child [2]:
Each SubMonitor only has one active child at a time. Each time newChild(int) or split(int) is called, the result becomes the new active child and any unused progress from the previously-active child is consumed.
This makes it unnecessary to call done() on a SubMonitor instance, since child monitors are automatically cleaned up the next time the parent is touched.
=> What is the recommended way to create child monitors if I don't want to execute one child after another but run them concurrently?
Creating the second monitor child would immediately result in a wrong total progress, since the first child is not finished yet.
Some ideas:
a) Don't use SubMonitor
at all for that concurrent case but stick to the deprecated SubProgressMontior
(I did not check if that would help, yet.)?
b) Somehow skip the consumption of unused progress? (The suppressFlags
that can be passed to the split method do not seem to provide a value for that.)
Related questions