Class ShutdownHookExamples

java.lang.Object
net.jrodolfo.java_evolution.java03.shutdown_hooks.ShutdownHookExamples

public class ShutdownHookExamples extends Object
Demonstrates JVM shutdown hooks, introduced in J2SE 1.3.
  • Field Details

  • Constructor Details

    • ShutdownHookExamples

      public ShutdownHookExamples()
  • Method Details

    • registerMarkerFileHook

      public void registerMarkerFileHook(File markerFile, String message)
      Registers a shutdown hook that writes a marker file during orderly JVM shutdown.
      Parameters:
      markerFile - file to write from the shutdown hook
      message - marker text
    • runChildProcessMode

      public int runChildProcessMode(String[] args)
      Entry point used by the test suite's child JVM.
      Parameters:
      args - first argument is the marker file path
      Returns:
      process exit code
    • main

      public static void main(String[] args)