Enum Class ErrorStrategy
- All Implemented Interfaces:
Serializable
,Comparable<ErrorStrategy>
,java.lang.constant.Constable
ErrorStrategy indicates what to do when there is an error in the execution of the simulation. In order to set the error
handling, the setPauseOnError() and isPauseOnError() methods are deprecated and replaced by new
setErrorStrategy(ErrorStrategy strategy) and getErrorStrategy() methods. The log level can be overridden (and even be set to
NONE).
Copyright (c) 2021-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information DSOL Manual. The DSOL project is distributed under a three-clause BSD-style license, which can be found at DSOL License.
- Author:
- Alexander Verbraeck
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionSend the error to the logger as WARNING.Send the error to logger as ERROR and print the exception on stderr.Send the error to logger as ERROR and print the exception on stderr The Simulator.cleanup() method is called to ensure the SimulatorWorkerThread.run() method completely ends and can be garbage collected.Send the error to logger as ERROR and print the exception on stderr The Simulator.cleanup() method is called to ensure the stop of the run() in SimulatorWorkerThread; the System.exit() method is called to end the complete program.Send the error to logger as ERROR and print the exception on stderr The RunState goes to STOPPING, leading to the stop of the loop in the Simulator.run() method and a subsequent STOPPED state in the SimulatorWorkerThread.run() method. -
Method Summary
Modifier and TypeMethodDescriptionfinal Level
Return the default log level for the ErrorStrategy (can be overridden in the Simulator) .static ErrorStrategy
Returns the enum constant of this class with the specified name.static ErrorStrategy[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
LOG_AND_CONTINUE
Send the error to the logger as WARNING. Both RunState and ReplicationState remain in the RUNNING state. The Simulator.run() continues as if the error did not occur. -
WARN_AND_CONTINUE
Send the error to logger as ERROR and print the exception on stderr. Both RunState and ReplicationState remain in the RUNNING state. The Simulator.run() continues as if the error did not occur. -
WARN_AND_PAUSE
Send the error to logger as ERROR and print the exception on stderr The RunState goes to STOPPING, leading to the stop of the loop in the Simulator.run() method and a subsequent STOPPED state in the SimulatorWorkerThread.run() method. The SimulatorWorkerThread will go into a Thread.wait(), to wait for start (or cleanup). -
WARN_AND_END
Send the error to logger as ERROR and print the exception on stderr The Simulator.cleanup() method is called to ensure the SimulatorWorkerThread.run() method completely ends and can be garbage collected. If there is a UI thread, it will keep running. -
WARN_AND_EXIT
Send the error to logger as ERROR and print the exception on stderr The Simulator.cleanup() method is called to ensure the stop of the run() in SimulatorWorkerThread; the System.exit() method is called to end the complete program.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getDefaultLogLevel
Return the default log level for the ErrorStrategy (can be overridden in the Simulator) .- Returns:
- Level: the default log level for the ErrorStrategy
-