Buggy code:
final class ManagedProcess { private final String processName ; private final List < String > command ; private final Map < String , String > env ; private final String workingDirectory ; private final ProcessLogger log ; private final Object lock ; private final ProcessController processController ; private final byte [ ] authKey ; private final boolean isPrivileged ; private final RespawnPolicy respawnPolicy ; private OutputStream stdin ; private ManagedProcess . State state = ManagedProcess . State . DOWN ; private Process process ; private boolean shutdown ; private boolean stopRequested = false ; private final AtomicInteger respawnCount = new AtomicInteger ( 0 ) ; public byte [ ] getAuthKey ( ) { } public boolean isPrivileged ( ) { } public boolean isRunning ( ) { } enum State { DOWN , STARTED , STOPPING ; } ManagedProcess ( final String processName , final List < String > command , final Map < String , String > env , final String workingDirectory , final Object lock , final ProcessController controller , final byte [ ] authKey , final boolean privileged , final boolean respawn ) { } int incrementAndGetRespawnCount ( ) { } int resetRespawnCount ( ) { } public String getProcessName ( ) { } public void start ( ) { } public void sendStdin ( final InputStream msg ) { } public void reconnect ( String hostName , int port , boolean managementSubsystemEndpoint ) { } void doStart ( boolean restart ) { } public void stop ( ) { } public void shutdown ( ) { } void respawn ( ) { } private final class JoinTask implements Runnable { private final long startTime ; public JoinTask ( final long startTime ) { } public void run ( ) { final Process process ; synchronized ( lock ) { process = ManagedProcess . this . process ; } int exitCode ; for ( ; ; ) try { exitCode = process . waitFor ( ) ; log . processFinished ( processName , Integer . valueOf ( exitCode ) ) ; break ; } catch ( InterruptedException e ) { } boolean respawn = false ; int respawnCount = 0 ; synchronized ( lock ) { final long endTime = System . currentTimeMillis ( ) ; processController . processStopped ( processName , ( endTime - ( startTime ) ) ) ; state = ManagedProcess . State . DOWN ; if ( shutdown ) { processController . removeProcess ( processName ) ; } else <START_BUG> if ( ( isPrivileged ( ) ) && ( exitCode == 99 ) ) { <END_BUG> processController . removeProcess ( processName ) ; new Thread ( new Runnable ( ) { public void run ( ) { processController . shutdown ( ) ; System . exit ( 0 ) ; } } ) . start ( ) ; } else { if ( ! ( stopRequested ) ) { respawn = true ; respawnCount = ManagedProcess . this . incrementAndGetRespawnCount ( ) ; } } stopRequested = false ; } if ( respawn ) { respawnPolicy . respawn ( respawnCount , ManagedProcess . this ) ; } } } private final class ReadTask implements Runnable { private final InputStream source ; private final PrintStream target ; private ReadTask ( final InputStream source , final PrintStream target ) { } public void run ( ) { final InputStream source = this . source ; final String processName = ManagedProcess . this . processName ; try { final BufferedReader reader = new BufferedReader ( new InputStreamReader ( new BufferedInputStream ( source ) ) ) ; final OutputStreamWriter writer = new OutputStreamWriter ( target ) ; String s ; while ( ( s = reader . readLine ( ) ) != null ) { synchronized ( target ) { writer . write ( '[' ) ; writer . write ( processName ) ; writer . write ( "]<seq2seq4repair_space>" ) ; writer . write ( s ) ; writer . write ( '\n' ) ; writer . flush ( ) ; } } source . close ( ) ; } catch ( IOException e ) { log . streamProcessingFailed ( processName , e ) ; } finally { StreamUtils . safeClose ( source ) ; } } } }

Fix:
if ( ( isPrivileged ( ) ) && ( exitCode == ( ExitCodes . HOST_CONTROLLER_ABORT_EXIT_CODE ) ) ) {