1.

What Is Addshutdownhook Method In Java?

Answer»

addShutdownHook method in java >
•addShutdownHook method registers a new virtual-machine shutdown hook.
•A shutdown hook is a initialized but unstarted thread.
•When JVM starts its shutdown it will start all REGISTERED shutdown HOOKS in some UNSPECIFIED order and LET them run concurrently.
When JVM (Java virtual machine) shuts down >
•When the last non-daemon thread finishes, or
•when the System.exit is called.
Once JVM’s shutdown has begunnew shutdown hook cannot be registered neither previously-registered hook can be de-registered. Any attempt made to do any of these operations causes an IllegalStateException.
For more detail with program read : Threads addShutdownHook method in java

addShutdownHook method in java >
•addShutdownHook method registers a new virtual-machine shutdown hook.
•A shutdown hook is a initialized but unstarted thread.
•When JVM starts its shutdown it will start all registered shutdown hooks in some unspecified order and let them run concurrently.
When JVM (Java virtual machine) shuts down >
•When the last non-daemon thread finishes, or
•when the System.exit is called.
Once JVM’s shutdown has begunnew shutdown hook cannot be registered neither previously-registered hook can be de-registered. Any attempt made to do any of these operations causes an IllegalStateException.
For more detail with program read : Threads addShutdownHook method in java



Discussion

No Comment Found