Affects Version/s: 0.9.2
Fix Version/s: 0.10.0
Use of @ThreadSafe and synchronized is somewhat sparse and inconsistent. @ThreadSafeAfterInit is never used.
I think we should document the assumption that:
- Components are constructed and initialized on a single thread.
- This implies that they need not be generally @ThreadSafe and there is no need to mark either constructors or property setters as synchronized.
- Components are @ThreadSafeAfterInit
- In some rare cases, this might require that property getters are synchronized, but I can't think of an instance where this would need to be the case in practice.
- Components such as stages need to be reentrant: their execute method may be called simultaneously from multiple threads (e.g., in parallel pipelines).
- This means that fields need to be either inherently @ThreadSafe, or synchronized appropriately. Synchronizing execute should be the last resort.