Class ParallelProgressManager
- Instantiate it with a parent progress receiver, and a task count (if known). Note: the parent progress receiver should be thread safe and not make assumptions about which threads its methods will be invoked from!
- Invoke createProgressReceiver() as many times as needed. Note: if the manager has not been created with a task count you cannot invoke this method any more after the first task has started!
- Start the tasks in background threads and invoke
join()on the manager to wait for all tasks to complete (defined as either invokingProgressReceiver.done()orProgressReceiver.exceptionThrown(Throwable)on their progress receivers).
If a task invokes ProgressReceiver.exceptionThrown(Throwable) it will
be reported to the parent progress receiver, and all subsequent invocations
on their progress receivers by any other tasks will result in an
ProgressReceiver.OperationCancelled exception being thrown. If any
more exceptions are reported these are not reported to the parent
progress receiver (instead they are logged using the java.util logging
framework). Also, if an exception has been reported,
ProgressReceiver.done() will not subsequently be invoked on the
parent progress receiver.
If no exceptions are reported, ProgressReceiver.done() will be
invoked on the parent progress receiver after the last task has invoked it on
its sub progress receiver.
All invocations on ProgressReceiver.setMessage(String) are passed
through unaltered to the parent progress receiver.
If the parent progress receiver throws an OperationCancelled
exception at any time, it is stored and rethrown to every task whenever they
next invoke a method (that declares it) on their sub progress receivers. It
is immediately rethrown to the calling task.
-
Constructor Summary
ConstructorsConstructorDescriptionParallelProgressManager(ProgressReceiver progressReceiver) ParallelProgressManager(ProgressReceiver progressReceiver, int taskCount) -
Method Summary
-
Constructor Details
-
ParallelProgressManager
-
ParallelProgressManager
-
-
Method Details
-
createProgressReceiver
-
join
- Throws:
InterruptedException
-
isExceptionThrown
public boolean isExceptionThrown()
-