public static void createServerRunningMarkerFile ( BootstrapConfig bootConfig ) { File serverWorkArea = bootConfig . getWorkareaFile ( null ) ; File serverRunningMarkerFile = null ; try { serverRunningMarkerFile = new File ( serverWorkArea , BootstrapConstants . SERVER_RUNNING_FILE ) ; serverRunningMarkerFile . deleteOnExit ( ) ; boolean newFile = serverRunningMarkerFile . createNewFile ( ) ; if ( ! newFile ) bootConfig . forceCleanStart ( ) ; } catch ( IOException e ) { throw new LaunchException ( "Can not create or write to server running marker file, check file permissions" , MessageFormat . format ( BootstrapConstants . messages . getString ( "error.serverDirPermission" ) , serverRunningMarkerFile . getAbsolutePath ( ) ) , e ) ; } }
Create a marker file when the server is running to determine if the JVM terminated normally . This file is deleted automatically when the JVM exits normally on a normal server stop . If the marker file already exists when the server is starting it assumes the JVM abended or the JVM process was forcefully terminated . In this case we mark the bootstrap properties to do a full clean of the workarea to remove any possible corruption that might have occurred as a result of the JVM abend .