Home / Class/ LogbackLoggingSystemParallelInitializationTests Class — spring-boot Architecture

LogbackLoggingSystemParallelInitializationTests Class — spring-boot Architecture

Architecture documentation for the LogbackLoggingSystemParallelInitializationTests class in LogbackLoggingSystemParallelInitializationTests.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

core/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemParallelInitializationTests.java lines 40–75

class LogbackLoggingSystemParallelInitializationTests {

	private final LoggingSystem loggingSystem = LoggingSystem.get(getClass().getClassLoader());

	@AfterEach
	void cleanUp() {
		this.loggingSystem.cleanUp();
		((LoggerContext) LoggerFactory.getILoggerFactory()).stop();
	}

	@Test
	@ForkedClassPath
	void noExceptionsAreThrownWhenBeforeInitializeIsCalledInParallel() {
		List<Thread> threads = new ArrayList<>();
		List<Throwable> exceptions = new CopyOnWriteArrayList<>();
		for (int i = 0; i < 10; i++) {
			Thread thread = new Thread(this.loggingSystem::beforeInitialize);
			thread.setUncaughtExceptionHandler((t, ex) -> exceptions.add(ex));
			threads.add(thread);
		}
		threads.forEach(Thread::start);
		threads.forEach(this::join);
		assertThat(exceptions).isEmpty();
	}

	private void join(Thread thread) {
		try {
			thread.join();
		}
		catch (InterruptedException ex) {
			Thread.currentThread().interrupt();
			throw new RuntimeException(ex);
		}
	}

}

Domain

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free