Class SynchronizedRunListener

java.lang.Object
org.junit.runner.notification.RunListener
org.junit.runner.notification.SynchronizedRunListener

@ThreadSafe final class SynchronizedRunListener extends RunListener
Thread-safe decorator for RunListener implementations that synchronizes calls to the delegate.

This class synchronizes all listener calls on a RunNotifier instance. This is done because prior to JUnit 4.12, all listeners were called in a synchronized block in RunNotifier, so no two listeners were ever called concurrently. If we instead made the methods here synchronized, clients that added multiple listeners that called common code might see issues due to the reduced synchronization.

Since:
4.12
See Also: