in troubleshooting/tools/log4j-tcp-app/src/main/java/com/mycompany/app/MultithreadApp.java [15:41]
public static void main(String[] args) throws InterruptedException {
CountDownLatch latch = new CountDownLatch(LOGGER_THREADS);
Runnable app_instance;
Thread thread;
boolean infinite = false;
System.out.println("log4j app multithread Mar-6-22");
LOGGER_THREADS = Integer.parseInt(System.getenv("LOGGER_THREADS"));
LOGGER_ITERATIONS = Integer.parseInt(System.getenv("LOGGER_ITERATIONS"));
LOG_SIZE_BYTES = Integer.parseInt(System.getenv("LOG_SIZE_BYTES"));
LOGGER_SLEEP_MS = Integer.parseInt(System.getenv("LOGGER_SLEEP_MS"));
String is_infinite = System.getenv("INFINITE");
if (is_infinite.startsWith("y") || is_infinite.startsWith("Y") || is_infinite.startsWith("T") || is_infinite.startsWith("t") ) {
infinite = true;
}
for (int i=0; i < LOGGER_THREADS; i++) {
app_instance = new LoggerApp(latch, i, LOGGER_ITERATIONS, LOG_SIZE_BYTES, LOGGER_SLEEP_MS, infinite);
thread = new Thread(app_instance);
thread.start();
}
latch.await();
}