Class CircuitBreaker

java.lang.Object
desmoj.core.simulator.NamedObject
desmoj.core.simulator.ModelComponent
desmoj.core.simulator.Schedulable
All Implemented Interfaces:
IRequestUpdateListener, Comparable<IRequestUpdateListener>

public final class CircuitBreaker
extends NetworkPattern
implements 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:
CircuitBreakerState, Microservice, MicroserviceInstance
  • Field Summary

    Fields inherited from class de.rss.fachstudie.MiSim.entities.patterns.InstanceOwnedPattern

    owner

    Fields inherited from class desmoj.core.simulator.Schedulable

    _schedule
  • Constructor Summary

    Constructors
    Constructor Description
    CircuitBreaker​(desmoj.core.simulator.Model model, String name, boolean showInTrace, MicroserviceInstance owner)  
  • Method Summary

    Modifier and Type Method Description
    int getListeningPriority()  
    boolean onRequestArrivalAtTarget​(Request request, desmoj.core.simulator.TimeInstant when)
    Listener for the successful completion of the sending process.
    boolean onRequestFailed​(Request request, desmoj.core.simulator.TimeInstant when, RequestFailedReason reason)
    Listener for the failure of the sending process.
    boolean onRequestResultArrivedAtRequester​(Request request, desmoj.core.simulator.TimeInstant when)
    Listener for the successful receiving of the answer of a request.
    boolean onRequestSend​(Request request, desmoj.core.simulator.TimeInstant when)
    Listener for the send-off of a request.
    void shutdown()
    Will be called by the owning instance upon an unexpected shutdown (kill)

    Methods inherited from class de.rss.fachstudie.MiSim.entities.patterns.Pattern

    initFields, onFieldInitCompleted

    Methods 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, setQueueingPriority

    Methods inherited from class desmoj.core.simulator.Schedulable

    assignReporter, cancel, getCorrespondingReportable, isCurrent, isScheduled, rename, reSchedule, reSchedule, reSchedulePreempt, scheduledNext, setCorrespondingReportable

    Methods 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, traceOn

    Methods inherited from class desmoj.core.simulator.NamedObject

    getName, getQuotedName, toString

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface de.rss.fachstudie.MiSim.entities.networking.IRequestUpdateListener

    compareTo
  • Constructor Details

    • CircuitBreaker

      public CircuitBreaker​(desmoj.core.simulator.Model model, String name, boolean showInTrace, MicroserviceInstance owner)
  • Method Details

    • getListeningPriority

      public int getListeningPriority()
      Specified by:
      getListeningPriority in interface IRequestUpdateListener
      Returns:
      the Priority of this Listener. Defaults to Priority#NORMAL
      See Also:
      Priority
    • shutdown

      public void shutdown()
      Description copied from class: Pattern
      Will be called by the owning instance upon an unexpected shutdown (kill)
      Specified by:
      shutdown in class Pattern
    • onRequestSend

      public boolean onRequestSend​(Request request, desmoj.core.simulator.TimeInstant when)
      Description copied from interface: IRequestUpdateListener
      Listener for the send-off of a request. Provides the send request.
      Specified by:
      onRequestSend in interface IRequestUpdateListener
      Parameters:
      request - request that triggered this event
      when - time of this event
      Returns:
      true if the request was terminally handled (consumed) by this instance
    • onRequestArrivalAtTarget

      public boolean onRequestArrivalAtTarget​(Request request, desmoj.core.simulator.TimeInstant when)
      Description copied from interface: IRequestUpdateListener
      Listener for the successful completion of the sending process. Provides a reference to the successfully arrived request.
      Specified by:
      onRequestArrivalAtTarget in interface IRequestUpdateListener
      Parameters:
      request - request that triggered this event
      when - 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: IRequestUpdateListener
      Listener for the successful receiving of the answer of a request.
      Specified by:
      onRequestResultArrivedAtRequester in interface IRequestUpdateListener
      Parameters:
      request - request that triggered this event
      when - 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: IRequestUpdateListener
      Listener 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:
      onRequestFailed in interface IRequestUpdateListener
      Parameters:
      request - request that triggered this event
      when - time of this event
      reason - reason why the request failed
      Returns:
      true if the request was terminally handled (consumed) by this instance