Class CircuitBreaker
java.lang.Object
desmoj.core.simulator.NamedObject
desmoj.core.simulator.ModelComponent
desmoj.core.simulator.Schedulable
desmoj.core.simulator.Entity
cambio.simulator.entities.NamedEntity
cambio.simulator.entities.patterns.InstanceOwnedPattern
cambio.simulator.entities.patterns.CircuitBreaker
- All Implemented Interfaces:
IRequestUpdateListener,IPatternLifeCycleHooks,Comparable<IRequestUpdateListener>
Manager class of all CircuitBreakers of one Microservice Instance.
Creates a CircuitBreakerState for each connection to another Microservice of the owning
MicroserviceInstance
This class is a NetworkPattern and therefore monitors all requests send by its owning
MicroserviceInstance.
- Author:
- Lion Wagner
- See Also:
-
Field Summary
Fields inherited from class cambio.simulator.entities.patterns.InstanceOwnedPattern
ownerFields inherited from class desmoj.core.simulator.Schedulable
_schedule -
Constructor Summary
ConstructorsConstructorDescriptionCircuitBreaker(desmoj.core.simulator.Model model, String name, boolean showInTrace) -
Method Summary
Modifier and TypeMethodDescriptionintGets the priority of this listener.voidonInitializedCompleted(desmoj.core.simulator.Model model) Will be called after completion of the initialization right after the config was injected.booleanonRequestFailed(Request request, desmoj.core.simulator.TimeInstant when, RequestFailedReason reason) Listener for the failure of the sending process.booleanonRequestResultArrivedAtRequester(Request request, desmoj.core.simulator.TimeInstant when) Listener for the successful receiving of the answer of a request.booleanonRequestSend(Request request, desmoj.core.simulator.TimeInstant when) Listener for the send-off of a request.voidshutdown()Will be called by the owning instance upon an unexpected shutdown (kill).Methods inherited from class cambio.simulator.entities.NamedEntity
getPlainName, getQuotedName, getQuotedPlainName, renameMethods inherited from class desmoj.core.simulator.Entity
clone, generateTraceForScheduling, getIdentNumber, getQueueingPriority, getQueues, getScheduledEvents, isEqual, isLarger, isLargerOrEqual, isNotEqual, isQueued, isSimProcess, isSmaller, isSmallerOrEqual, schedule, schedule, schedule, schedule, schedule, schedule, schedule, schedule, schedule, scheduleAfter, scheduleAfter, scheduleAfter, scheduleBefore, scheduleBefore, scheduleBefore, schedulePreempt, schedulePreempt, schedulePreempt, setQueueingPriorityMethods inherited from class desmoj.core.simulator.Schedulable
assignReporter, cancel, getCorrespondingReportable, isCurrent, isScheduled, reSchedule, reSchedule, reSchedulePreempt, scheduledNext, setCorrespondingReportableMethods inherited from class desmoj.core.simulator.ModelComponent
current, currentEntity, currentEntityAll, currentEvent, currentlySendDebugNotes, currentlySendTraceNotes, currentModel, currentSimProcess, debugIsOn, debugOff, debugOn, getModel, isExperimentCompatible, isModelCompatible, presentTime, sendDebugNote, sendMessage, sendTraceNote, sendWarning, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOnMethods inherited from class desmoj.core.simulator.NamedObject
getName, toStringMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface cambio.simulator.entities.patterns.IPatternLifeCycleHooks
startMethods inherited from interface cambio.simulator.entities.networking.IRequestUpdateListener
compareTo, onRequestArrivalAtTarget
-
Constructor Details
-
CircuitBreaker
-
-
Method Details
-
getListeningPriority
public int getListeningPriority()Description copied from interface:IRequestUpdateListenerGets the priority of this listener. Listeners with higher priority will be notified first about the status of a request. The interaction for listeners with equal priority is undefined.- Specified by:
getListeningPriorityin interfaceIRequestUpdateListener- Returns:
- the Priority of this Listener. Defaults to
Priority#NORMAL - See Also:
-
shutdown
public void shutdown()Description copied from interface:IPatternLifeCycleHooksWill be called by the owning instance upon an unexpected shutdown (kill). TODO: distinguish killed and shutdown better, this method will only represent a soft shutdown later- Specified by:
shutdownin interfaceIPatternLifeCycleHooks
-
onRequestSend
Description copied from interface:IRequestUpdateListenerListener for the send-off of a request. Provides the send request.- Specified by:
onRequestSendin interfaceIRequestUpdateListener- Parameters:
request- request that triggered this eventwhen- time of this event- Returns:
- true if the request was terminally handled (consumed) by this instance
-
onRequestResultArrivedAtRequester
public boolean onRequestResultArrivedAtRequester(Request request, desmoj.core.simulator.TimeInstant when) Description copied from interface:IRequestUpdateListenerListener for the successful receiving of the answer of a request.- Specified by:
onRequestResultArrivedAtRequesterin interfaceIRequestUpdateListener- Parameters:
request- request that triggered this eventwhen- time of this event- Returns:
- true if the request was terminally handled (consumed) by this instance
-
onRequestFailed
public boolean onRequestFailed(Request request, desmoj.core.simulator.TimeInstant when, RequestFailedReason reason) Description copied from interface:IRequestUpdateListenerListener for the failure of the sending process. This could for example be due to the receiving service not being available, the request being canceled or timed out. Provides a reference to the failed request.- Specified by:
onRequestFailedin interfaceIRequestUpdateListener- Parameters:
request- request that triggered this eventwhen- time of this eventreason- reason why the request failed- Returns:
- true if the request was terminally handled (consumed) by this instance
-
onInitializedCompleted
public void onInitializedCompleted(desmoj.core.simulator.Model model) Description copied from interface:IPatternLifeCycleHooksWill be called after completion of the initialization right after the config was injected.- Specified by:
onInitializedCompletedin interfaceIPatternLifeCycleHooks
-