Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class LogProducingService {
private static final Logger LOGGER = LoggerFactory.getLogger(LogProducingService.class);
public void writeSomeLoggingStatements(String message) {
LOGGER.info("Let's assert some logs! " + message);
ExecutorService executor = Executors.newSingleThreadExecutor();
Future<?> future = executor.submit(() -> LOGGER.info("This message is in a separate thread"));
do {
// wait for future to complete
} while (!future.isDone());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment