...
To perform a graceful shut down of the GatewayClient, allowing for all subsystems to save any critical data and release system resources , (such as file handles, open ports, user threads), you must call the shutdown() method. Since the GatewayClient creates user threads, not performing a shutdown may keep the JVM running even after your application has exited.
...