Package burp.mcp.util

Class CircuitBreaker

java.lang.Object
burp.mcp.util.CircuitBreaker

public class CircuitBreaker extends Object
Circuit breaker for external-calling tools. Tracks failures in a sliding 60s window. After 5 consecutive failures, opens the circuit for 30s, then allows one probe request.
  • Constructor Details

    • CircuitBreaker

      public CircuitBreaker(String toolName)
  • Method Details

    • allowRequest

      public String allowRequest()
      Called before executing the tool. Returns null if allowed, or an error message if the circuit is open.
    • recordSuccess

      public void recordSuccess()
      Called when a tool call succeeds.
    • recordFailure

      public void recordFailure()
      Called when a tool call fails.
    • reset

      public void reset()
    • getState

      public CircuitBreaker.State getState()
    • getToolName

      public String getToolName()
    • getTotalFailures

      public long getTotalFailures()
    • getTotalTrips

      public long getTotalTrips()