public static Command toShutdown( Shutdown shutdownType ) { return new Command( SHUTDOWN, shutdownType.name() ); }
private void warnIfWrongShutdownValue() throws MojoFailureException { if ( !Shutdown.isKnown( getShutdown() ) ) { throw new MojoFailureException( "Parameter \"shutdown\" should have values " + Shutdown.listParameters() ); } }
private void exitByConfiguration() { Shutdown shutdown = CommandReader.this.shutdown; // won't read inconsistent changes through the stack if ( shutdown != null ) { CommandReader.this.makeQueueFull(); CommandReader.this.wakeupIterator(); insertToListeners( toShutdown( shutdown ) ); if ( shutdown.isExit() ) { System.exit( 1 ); } else if ( shutdown.isKill() ) { Runtime.getRuntime().halt( 1 ); } // else is default: other than Shutdown.DEFAULT should not happen; otherwise you missed enum case } } }
/** * @return {@link Shutdown} or {@link Shutdown#DEFAULT} if {@link #getData()} is null or blank string * @throws IllegalArgumentException if string data {@link #getData()} is not applicable to enum {@link Shutdown} */ public Shutdown toShutdownData() { if ( !isType( SHUTDOWN ) ) { throw new IllegalStateException( "expected MasterProcessCommand.SHUTDOWN" ); } return isBlank( data ) ? DEFAULT : Shutdown.valueOf( data ); }
public static Shutdown parameterOf( String parameter ) { for ( Shutdown shutdown : values() ) { if ( shutdown.param.equals( parameter ) ) { return shutdown; } } return DEFAULT; } }
public void setShutdown( Object o, Shutdown shutdown ) { if ( shutdownAwareClass.isAssignableFrom( o.getClass() ) ) { for ( Enum e : shutdownClass.getEnumConstants() ) { if ( shutdown.ordinal() == e.ordinal() ) { invokeSetter( o, "setShutdown", shutdownClass, e ); break; } } } }
Shutdown.parameterOf( getShutdown() ), getForkedProcessExitTimeoutInSeconds() );
private void exitByConfiguration() { Shutdown shutdown = CommandReader.this.shutdown; // won't read inconsistent changes through the stack if ( shutdown != null ) { CommandReader.this.makeQueueFull(); CommandReader.this.wakeupIterator(); insertToListeners( toShutdown( shutdown ) ); if ( shutdown.isExit() ) { System.exit( 1 ); } else if ( shutdown.isKill() ) { Runtime.getRuntime().halt( 1 ); } // else is default: other than Shutdown.DEFAULT should not happen; otherwise you missed enum case } } }
/** * @return {@link Shutdown} or {@link Shutdown#DEFAULT} if {@link #getData()} is null or blank string * @throws IllegalArgumentException if string data {@link #getData()} is not applicable to enum {@link Shutdown} */ public Shutdown toShutdownData() { if ( !isType( SHUTDOWN ) ) { throw new IllegalStateException( "expected MasterProcessCommand.SHUTDOWN" ); } return isBlank( data ) ? DEFAULT : Shutdown.valueOf( data ); }
public static boolean isKnown( String param ) { for ( Shutdown shutdown : values() ) { if ( shutdown.param.equals( param ) ) { return true; } } return false; }
public void setShutdown( Object o, Shutdown shutdown ) { if ( shutdownAwareClass.isAssignableFrom( o.getClass() ) ) { for ( Enum e : shutdownClass.getEnumConstants() ) { if ( shutdown.ordinal() == e.ordinal() ) { invokeSetter( o, "setShutdown", shutdownClass, e ); break; } } } }
Shutdown.parameterOf( getShutdown() ), getForkedProcessExitTimeoutInSeconds() );
@Override public void update( Command command ) { Shutdown shutdown = command.toShutdownData(); if ( shutdown.isKill() ) { DumpErrorSingleton.getSingleton() .dumpText( "Killing self fork JVM. Received SHUTDOWN command from Maven shutdown hook." ); kill(); } else if ( shutdown.isExit() ) { cancelPingScheduler(); DumpErrorSingleton.getSingleton() .dumpText( "Exiting self fork JVM. Received SHUTDOWN command from Maven shutdown hook." ); exit( 1 ); } // else refers to shutdown=testset, but not used now, keeping reader open } };
public static Command toShutdown( Shutdown shutdownType ) { return new Command( SHUTDOWN, shutdownType.name() ); }
Shutdown shutdown = Shutdown.valueOf( properties.getProperty( SHUTDOWN ) );
private void warnIfWrongShutdownValue() throws MojoFailureException { if ( !Shutdown.isKnown( getShutdown() ) ) { throw new MojoFailureException( "Parameter \"shutdown\" should have values " + Shutdown.listParameters() ); } }
public static boolean isKnown( String param ) { for ( Shutdown shutdown : values() ) { if ( shutdown.param.equals( param ) ) { return true; } } return false; }
properties.setProperty( PROVIDER_CONFIGURATION, providerConfiguration.getProviderClassName() ); properties.setProperty( FAIL_FAST_COUNT, toString( booterConfiguration.getSkipAfterFailureCount() ) ); properties.setProperty( SHUTDOWN, booterConfiguration.getShutdown().name() ); List<CommandLineOption> mainCliOptions = booterConfiguration.getMainCliOptions(); if ( mainCliOptions != null )