Skip to content

Instantly share code, notes, and snippets.

@wkorando
Last active July 30, 2018 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wkorando/ec87df9b3e816979446776f813be65a1 to your computer and use it in GitHub Desktop.
Save wkorando/ec87df9b3e816979446776f813be65a1 to your computer and use it in GitHub Desktop.
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