stella.error
Class ResetFinalizer

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.AbstractErrorFinalizer
                  extended by stella.xml.XMLErrorFinalizer
                      extended by stella.error.ResetFinalizer
All Implemented Interfaces:
Cloneable, ErrorFinalizing, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class ResetFinalizer
extends XMLErrorFinalizer

This finalizer replaces a pure XMLErrorFinalizer for errors that are allowed to occur at a certain frequency, but are then replaced by an alternate sequence. Additionally to the parent class, this finalizer has an KEY_ALTERNATEFILE sequence specified, which is an alternate sequence to load, pointing to a file in the same way as the XMLErrorFinalizer.KEY_XMLFILE does. Each time an error with the appropriate follow-up is encountered, it's occurence time is stored in a list. If the number of appropriate errors received within KEY_INTERVAL exceeds KEY_MAXNUMBER, then the alternate sequence is loaded. Note that further occurences of the error might nevertheless spark the original sequence to be executed, if the error frequency cools down accordingly.


Nested Class Summary
 
Nested classes/interfaces inherited from class stella.xml.XMLErrorFinalizer
XMLErrorFinalizer.ErrorDistributor
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static String DEFALTERNATEFILE
          A file holding the shutdown sequence.
private static String DEFALTERNATETYPE
          A file holding the shutdown sequence.
private static long DEFINTERVAL
          The default time intervall, in ms.
private static int DEFMAXNUMBER
          The default maximum number of occurences within the time interval.
static String KEY_ALTERNATEFILE
          The xml-file to load if error-frequency is too high.
static String KEY_ALTERNATETYPE
          The type of the alternate sequence.
static String KEY_INTERVAL
          The base time intervall.
static String KEY_MAXNUMBER
          The maximum number of errors occured within the base time interval.
private  List times
          A list of error-occurence times.
 
Fields inherited from class stella.xml.XMLErrorFinalizer
ABORT, APPEND, KEY_FOLLOWUP, KEY_TYPE, KEY_XMLFILE, PREPEND
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
ResetFinalizer(Map prop)
          Constructs a new reset finalizer.
 
Method Summary
 boolean finalizeError(TargetDefinition src, ErrorEvent ee, CommandLaunching[] dummy, Sequencing seq, ParameterClustering set)
          The incomming errors.
 
Methods inherited from class stella.xml.XMLErrorFinalizer
getFollowUp, isAborting, isFinalizing, startRecovery
 
Methods inherited from class stella.AbstractErrorFinalizer
createErrorFinalizer, setMonitor, wake
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, init, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface stella.ErrorFinalizing
setMonitor
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.Initializable
init
 

Field Detail

KEY_ALTERNATEFILE

public static final String KEY_ALTERNATEFILE
The xml-file to load if error-frequency is too high.

See Also:
Constant Field Values

KEY_ALTERNATETYPE

public static final String KEY_ALTERNATETYPE
The type of the alternate sequence.

See Also:
Constant Field Values

KEY_INTERVAL

public static final String KEY_INTERVAL
The base time intervall.

See Also:
Constant Field Values

KEY_MAXNUMBER

public static final String KEY_MAXNUMBER
The maximum number of errors occured within the base time interval.

See Also:
Constant Field Values

DEFALTERNATEFILE

private static final String DEFALTERNATEFILE
A file holding the shutdown sequence. Last resort of error handling.

See Also:
Constant Field Values

DEFALTERNATETYPE

private static final String DEFALTERNATETYPE
A file holding the shutdown sequence. Last resort of error handling.

See Also:
Constant Field Values

DEFINTERVAL

private static final long DEFINTERVAL
The default time intervall, in ms.

See Also:
Constant Field Values

DEFMAXNUMBER

private static final int DEFMAXNUMBER
The default maximum number of occurences within the time interval.

See Also:
Constant Field Values

times

private List times
A list of error-occurence times.

Constructor Detail

ResetFinalizer

public ResetFinalizer(Map prop)
Constructs a new reset finalizer. Defaults the interval to 5 minutes at a frequency of 0.033333Hz.

Method Detail

finalizeError

public boolean finalizeError(TargetDefinition src,
                             ErrorEvent ee,
                             CommandLaunching[] dummy,
                             Sequencing seq,
                             ParameterClustering set)
The incomming errors. First, the error-time is recorded and stored in the times list. From this occurence time, all outdated entries from the times list are deleted. If the size of the list is then still larger then KEY_MAXNUMBER, the alternate sequence KEY_ALTERNATEFILE is loaded and executed using its KEY_ALTERNATETYPE style.

Specified by:
finalizeError in interface ErrorFinalizing
Overrides:
finalizeError in class XMLErrorFinalizer