Changing the configuration from multiple threads.

Using UI it is possible to change the broker configuration from multiple browsers at the same time.
The one way of making it thread safe is to introduce a single thread where all the changes can be applied.

The diagram below demonstrates how the thread safe configuration modification can be implemented.
The special class TaskExecutor is responsible for starting/stopping and running the work thread where the changes can be made.
The change can be submitted as a Callable which is invoked from the dispatcher thread to do the change (set attribute, create child, change state).
3 standard Callable implementations are displayed on diagram to perform the configuration changes. They should cover the majority of the existing use cases to change the configuration. In case when a new configuration change is required we can implement a special Callable which can be submitted into TaskExecutor to perform the change.

TaskExecutor provides 2 methods to submit the work as Callable:

  • submit
  • submitAndWait

The first method submits the task and returns the Future and second blocks until the change is applied.
On the sequence diagrams below the blocking method is used to submit the change.

Configuration Change Event Model 2
  • No labels