view launcher/src/main/java/com/redhat/thermostat/launcher/internal/ExitStatusImpl.java @ 1049:3f0416e9db80

Don't use System.exit anywhere other than in Laucher. Reviewed-by: omajid Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-March/006029.html
author Severin Gehwolf <sgehwolf@redhat.com>
date Fri, 08 Mar 2013 14:28:35 +0100
parents 8ea56b57334c
children
line wrap: on
line source

package com.redhat.thermostat.launcher.internal;

import com.redhat.thermostat.common.ExitStatus;

/**
 * @see {@link ExitStatus}
 *
 */
public class ExitStatusImpl implements ExitStatus {

    private int exitStatus;
    
    ExitStatusImpl(int initialExitStatus) {
        this.exitStatus = initialExitStatus;
    }
    
    public synchronized void setExitStatus(int newExitStatus)
            throws IllegalArgumentException {
        if (newExitStatus < 0 || newExitStatus > 255) {
            throw new IllegalArgumentException(
                    "Status (" + newExitStatus + ") out ouf range. 0 <= status <= 255.");
        }
        this.exitStatus = newExitStatus;
    }
    
    public synchronized int getExitStatus() {
        return this.exitStatus;
    }
}