1public class EventLoggingTask implements Runnable{
2 private Logger logger
3 = LoggerFactory.getLogger(EventLoggingTask.class);
4
5 @Override
6 public void run() {
7 logger.info("Message");
8 }
9}
1public void executeTask() {
2 executorService = Executors.newSingleThreadExecutor();
3 Future future = executorService.submit(new EventLoggingTask());
4 executorService.shutdown();
5}