public class MasterErrorHandler extends AbstractErrorHandler implements WeatherListener, RmiWeatherListener, RmiErrorListener, Initializable
ErrorFinalizing objects. Incoming error messages are
queried for their required follow-up action. A lookup table is then used to
match the required follow-up action to an ErrorFinalizing object. The
error is now passed to the ErrorFinalizing.finalizeError(target.TargetDefinition, stella.ErrorEvent, stella.CommandLaunching[], stella.Sequencing<?>, stella.ParameterClustering) method which
should return fast and does all necessary steps to recover from the error. If
recovery fails for any reason, i.e. if ErrorFinalizing.finalizeError(target.TargetDefinition, stella.ErrorEvent, stella.CommandLaunching[], stella.Sequencing<?>, stella.ParameterClustering)
returns false, or if the error received cannot be matched to a finalizer, the
fatalError(stella.ErrorEvent) method is called.
Additionally, errors related to Handable targets are treated.
Whenever a TargetDefinition is started using the startTarget(stella.Handable)
method, it is copied into the current list. PickConnected
errors are then first assigned to the most currently started target. If this
target has parents that are additionally in the current list, the
error is propagated up until either no further parent is assigned to a target
or if the parent in question is not in the current list. Targets may react to
this errors with abort or retries, see e.g. DOMTarget.
| Modifier and Type | Class and Description |
|---|---|
protected class |
MasterErrorHandler.NoneErrorFinalizer
A default finalizer class for
ErrorEvent.NONE follow-ups. |
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private List<Handable> |
current
A list of currently started targets for
PickConnected errors. |
private static String |
DEFPICKREPLACE
Per default, we use a mail finalizer on pick-realated errors.
|
private Map<String,ErrorFinalizing> |
handle
A lookup table linking follow-ups to error handlers.
|
private boolean |
ignore
A boolean indicating that incoming error should be ignored.
|
static String |
KEY_HANDLERS
The key to the coma-separated list of error finalizers.
|
static String |
KEY_PICKREPLACE
Pick connected errors with NONE get a different error handler.
|
static String |
KEY_REMOTE
The key to the remote error casters.
|
static String |
KEY_WEATHER
The key to the remote weather caster.
|
private Sequencing |
sequencer
A link to the main sequencer.
|
private CommandLaunching[] |
servers
A link to the command servers.
|
private ParameterClustering |
set
A link to the main parameter set.
|
private WeatherSurveying |
weather
The local weather station if any.
|
KEY_ALIVE, KEY_EXPORTPORT, KEY_INIT, KEY_LISTENERNAME, KEY_RETRY, KEY_RETRYSLEEP, KEY_SHUTDOWNDELAYKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORCONFIG, KEY_CLASSKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME| Constructor and Description |
|---|
MasterErrorHandler(Map<String,String> prop)
Constructs a new simple error handler.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
deregisterAtCaster(RmiCaster caster,
Class service)
Adds the ability to deregister at rmi-weather casters.
|
boolean |
doAbort()
Returns true if the error handler is dealing with a target abort.
|
void |
endTarget(Handable end)
Removes a target from the error-handlers current list.
|
void |
errorOccured(ErrorEvent ee)
The incomming errors.
|
void |
exit()
Signals that the error handler is shuting down and incoming errors should
be ignored.
|
private void |
fatalError(ErrorEvent ee)
This error handler is invoked when everything else fails.
|
void |
init()
Registers at a remote weather caster to tranform bad weather events into
BadWeather and GoodWeather errors. |
private void |
notifyTargets(ErrorEvent ee,
ErrorFinalizing finish,
ParameterClustering set)
If a
PickConnected error was registered, the list of currently
active targets is traversed. |
protected boolean |
registerAtCaster(RmiCaster caster,
Class service)
Adds the ability to register at rmi-weather casters.
|
void |
registerGlobals(ParameterClustering cluster)
Registers the parameter cluster.
|
void |
registerLauncher(CommandLaunching[] device)
Registers the command servers.
|
void |
registerMonitor(Object sleeper)
Registers the monitor.
|
void |
registerSequencer(Sequencing seq)
Registers the command sequencer.
|
void |
registerWeather(WeatherSurveying fake)
Registers a local weather station to the error handler.
|
void |
rmiErrorOccured(ErrorEvent ee)
This method is invoked by remote error casters.
|
void |
rmiWeatherChanged(WeatherEvent we)
Handles weather events.
|
void |
setEnabled(boolean accept)
Enables the error handler, meaning that incoming errors are no longer
ignored.
|
void |
startTarget(Handable start)
Adds a target to the handler's
current list. |
void |
weatherChanged(WeatherEvent we)
Handles weather events.
|
createErrorHandlerallBound, blockBinding, blockBinding, disconnect, getIP, getListenerName, isConnected, listenerName, releaseBinding, releaseBinding, rescanned, startBinding, startBindingcontainsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemotePropertyclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, 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, parseObject, reload, removeProperty, requires, setObject, setProperties, setProperty, stringProperties, toStringequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetListenerNamedisconnect, isConnecteddefaultBoolean, 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, stringPropertiespublic static final String KEY_HANDLERS
public static final String KEY_WEATHER
public static final String KEY_REMOTE
public static final String KEY_PICKREPLACE
private static final String DEFPICKREPLACE
private Map<String,ErrorFinalizing> handle
private CommandLaunching[] servers
private Sequencing sequencer
private ParameterClustering set
private WeatherSurveying weather
private boolean ignore
private List<Handable> current
PickConnected errors.public MasterErrorHandler(Map<String,String> prop) throws RemoteException
RemoteExceptionpublic void init()
BadWeather and GoodWeather errors. Additionally registers
at all remote error casters given with the KEY_REMOTE property.
Scans the KEY_HANDLERS key to construct and load appropriate
ErrorFinalizers for handling of incoming errors. If the
ErrorEvent.NONE has no explicit handler specified, the
MasterErrorHandler.NoneErrorFinalizer is used.init in interface Initializablepublic void setEnabled(boolean accept)
setEnabled in interface ErrorHandlingpublic void registerLauncher(CommandLaunching[] device)
KEY_REMOTE.registerLauncher in interface ErrorHandlingpublic void registerSequencer(Sequencing seq)
registerSequencer in interface ErrorHandlingpublic void registerWeather(WeatherSurveying fake)
KEY_WEATHER key. Local weather station may be present in case of
simulated action only.registerWeather in interface ErrorHandlingpublic void registerGlobals(ParameterClustering cluster)
registerGlobals in interface ClusterDependingpublic void registerMonitor(Object sleeper)
ErrorFinalizing instances. This method should
only be called after all error finalizers have been initialized.registerMonitor in interface ErrorHandlingpublic void startTarget(Handable start)
current list. All targets stored
there may receive PickConnected errors. If such an error is
received, the most recently added targets receives it first.startTarget in interface ErrorHandlingpublic void endTarget(Handable end)
endTarget in interface ErrorHandlingpublic boolean doAbort()
doAbort in interface ErrorHandlingpublic void exit()
exit in interface ExitCleaningexit in class AbstractRmiListenerpublic void rmiWeatherChanged(WeatherEvent we) throws RemoteException
rmiWeatherChanged in interface RmiWeatherListenerRemoteExceptionpublic void weatherChanged(WeatherEvent we)
weatherChanged in interface WeatherListenerpublic void rmiErrorOccured(ErrorEvent ee) throws RemoteException
errorOccured(stella.ErrorEvent) method.rmiErrorOccured in interface RmiErrorListenerRemoteExceptionpublic void errorOccured(ErrorEvent ee)
ErrorFinalizing object is loaded and executed. If the
error has a raised pipe-flag, it is passed to the parameter cluster
registered to this error handler.
To judge fast return from this event-handling methods, consider:
PickConnected. Callers can be assured that all targets have their
fields updated on method return.ParameterConnected the caller can
be assured that the parameter set has been notified.ErrorFinalizing method spark
invocation of the appropriate method. Most finalizers will run in their
own thread, so no statement can be made on their status after method
call.errorOccured in interface ErrorListenerprotected boolean registerAtCaster(RmiCaster caster, Class service)
registerAtCaster in class AbstractRmiListenerprotected boolean deregisterAtCaster(RmiCaster caster, Class service)
deregisterAtCaster in class AbstractRmiListenerprivate void notifyTargets(ErrorEvent ee, ErrorFinalizing finish, ParameterClustering set)
PickConnected error was registered, the list of currently
active targets is traversed. Starting from the currently executing target
(the last one added with startTarget(stella.Handable)), all precursors present in
current are notified. The individual target getting notifies
receives the error on its appropriate end. An error that occured in the
currently observed target radiates to Handable.errorMain(stella.ErrorEvent, stella.ErrorFinalizing, stella.ParameterClustering), while
precursors that have the currently queried target as successor or
daughter are notified accordingly.private void fatalError(ErrorEvent ee)
CommandLaunching.getShutdownCommand() to the peripherals.