And here is how to tell the executor to terminate gracefully (if you fail to do this, it is likely that your VM will not exit):
failing to do this is also a memory leak. If your application creates executors repeatedly (without shutting them down, even if you dereference them), it will build up memory usage, possibly eventually causing the application to fail.