I have java.util.Timer working with fixed interval. I added Runtime#addShutdownHook and shuts down when the virtual machine finishes normally or abnormally. However, it keeps the virtual machine alive when main completes, unless I insist on running System.exit on main . Is there a way to check if I am the last character of Thread , or in some other way to avoid changing the main , which will complete normally with completion?
<sub> Note: I know that many people think java.util.Timer deprecated (itβs not), but if your alternative doesnβt help me solve this problem ... Sub>
source share