org.cougaar.core.service
Interface SuicideService

All Superinterfaces:
org.cougaar.core.component.Service

public interface SuicideService
extends org.cougaar.core.component.Service

This service is used to tell the agent (or node) to exit, for example due to an OutOfMemoryError.

The intent is to allow major components to report that they have recognised that they have been corrupted by various means and so should be restarted.

System Properties:
org.cougaar.core.service.SuicideService.enableIf true, will enable suicide of Nodes and Agents. Otherwise, the suicide API exists but only logs attempts rather than actually kills anything. The default is false.
org.cougaar.core.service.SuicideService.proactiveIf true, the SuicideService will attempt to kill things proactively when it notices low-memory situations. Defaults to true, but only takes effect if the SuicideService is enabled.
org.cougaar.core.service.SuicideService.proactivePeriodDefines the period of proactive suicide checks, in seconds. By default, this is 1.
org.cougaar.core.service.SuicideService.lowMemSpecify a quantity of memory to use as the definition of "dangerously low" for proactive kill situations. This is interpreted as a factor of Runtime.maxMemory(). The default value is "0.02" meaning 2 percent. If this value is greater than or equal to 1.0, then it is interpreted as a number of kilobytes. Examples: if maxMemory is 100Mb, then "0.005" and "512" are both interpreted as one half a megabyte.

Field Summary
static int EXIT_CODE
          If the VM exits as a result of a suicide call, it will do so using this value.
static boolean isProactiveEnabled
           
static boolean isProactiveEnabled_default
           
static boolean isSuicideEnabled
           
static boolean isSuicideEnabled_default
           
static double lowMem
           
static double lowMem_default
           
static java.lang.String LOWMEM_PROP
           
static java.lang.String PROACTIVE_PROP
           
static double proactivePeriod
           
static double proactivePeriod_default
           
static java.lang.String PROPERIOD_PROP
           
static java.lang.String SUICIDE_PROP
           
 
Method Summary
 void die(java.lang.Object component, java.lang.Throwable error)
          Report a fatal error and die.
 

Field Detail

EXIT_CODE

static final int EXIT_CODE
If the VM exits as a result of a suicide call, it will do so using this value.

See Also:
Constant Field Values

SUICIDE_PROP

static final java.lang.String SUICIDE_PROP

isSuicideEnabled_default

static final boolean isSuicideEnabled_default
See Also:
Constant Field Values

isSuicideEnabled

static final boolean isSuicideEnabled

PROACTIVE_PROP

static final java.lang.String PROACTIVE_PROP

isProactiveEnabled_default

static final boolean isProactiveEnabled_default
See Also:
Constant Field Values

isProactiveEnabled

static final boolean isProactiveEnabled

PROPERIOD_PROP

static final java.lang.String PROPERIOD_PROP

proactivePeriod_default

static final double proactivePeriod_default
See Also:
Constant Field Values

proactivePeriod

static final double proactivePeriod

LOWMEM_PROP

static final java.lang.String LOWMEM_PROP

lowMem_default

static final double lowMem_default
See Also:
Constant Field Values

lowMem

static final double lowMem
Method Detail

die

void die(java.lang.Object component,
         java.lang.Throwable error)
Report a fatal error and die. This call might not return.

Parameters:
component - Which component should be killed. May be specified as null, implying that the whole node is suspect, or a specific component descriptor (e.g. an agent name). It is probably illegal to specify a component other than yourself or null.
error - The error indicating the problem. An attempt will be made to log the error during the component's death throws. May not be specified as null.