Record Class ResourceBudget

java.lang.Object
java.lang.Record
org.j7m.middleware.api.isolation.ResourceBudget
Record Components:
maxConcurrentExecutions - maximum concurrent executions in provider
maxRuntime - maximum runtime before timeout
maxStdoutBytes - maximum captured stdout bytes
maxStderrBytes - maximum captured stderr bytes
maxEnvironmentVariables - maximum exposed environment variables
maxEnvironmentBytes - maximum aggregate environment bytes
maxCommandLineBytes - maximum command-line bytes
maxQueueBacklog - maximum pending backlog policy value
cpuBudget - advisory CPU budget
memoryBudget - advisory memory budget
threadBudget - thread budget
queueBudget - queue/backlog budget classification

public record ResourceBudget(int maxConcurrentExecutions, Duration maxRuntime, int maxStdoutBytes, int maxStderrBytes, int maxEnvironmentVariables, int maxEnvironmentBytes, int maxCommandLineBytes, int maxQueueBacklog, CpuBudget cpuBudget, MemoryBudget memoryBudget, ThreadBudget threadBudget, QueueBudget queueBudget) extends Record
Bounded resource budget for an isolation request.

The budget is immutable and thread-safe. Pure-Java providers enforce concurrency, runtime, output, environment, and command-line limits. The Java-only baseline has no internal work queue, so queue/backlog values are policy metadata unless a future provider reports stronger support. CPU, memory, and working-directory-size values are advisory or policy hooks unless an implementation reports stronger support.

  • Constructor Details

    • ResourceBudget

      public ResourceBudget(int maxConcurrentExecutions, Duration maxRuntime, int maxStdoutBytes, int maxStderrBytes, int maxEnvironmentVariables, int maxEnvironmentBytes, int maxCommandLineBytes, int maxQueueBacklog, CpuBudget cpuBudget, MemoryBudget memoryBudget, ThreadBudget threadBudget, QueueBudget queueBudget)
      Creates a validated budget.
  • Method Details

    • defaults

      public static ResourceBudget defaults()
      Returns a conservative default budget for local test and demo execution.
      Returns:
      default budget
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • maxConcurrentExecutions

      public int maxConcurrentExecutions()
      Returns the value of the maxConcurrentExecutions record component.
      Returns:
      the value of the maxConcurrentExecutions record component
    • maxRuntime

      public Duration maxRuntime()
      Returns the value of the maxRuntime record component.
      Returns:
      the value of the maxRuntime record component
    • maxStdoutBytes

      public int maxStdoutBytes()
      Returns the value of the maxStdoutBytes record component.
      Returns:
      the value of the maxStdoutBytes record component
    • maxStderrBytes

      public int maxStderrBytes()
      Returns the value of the maxStderrBytes record component.
      Returns:
      the value of the maxStderrBytes record component
    • maxEnvironmentVariables

      public int maxEnvironmentVariables()
      Returns the value of the maxEnvironmentVariables record component.
      Returns:
      the value of the maxEnvironmentVariables record component
    • maxEnvironmentBytes

      public int maxEnvironmentBytes()
      Returns the value of the maxEnvironmentBytes record component.
      Returns:
      the value of the maxEnvironmentBytes record component
    • maxCommandLineBytes

      public int maxCommandLineBytes()
      Returns the value of the maxCommandLineBytes record component.
      Returns:
      the value of the maxCommandLineBytes record component
    • maxQueueBacklog

      public int maxQueueBacklog()
      Returns the value of the maxQueueBacklog record component.
      Returns:
      the value of the maxQueueBacklog record component
    • cpuBudget

      public CpuBudget cpuBudget()
      Returns the value of the cpuBudget record component.
      Returns:
      the value of the cpuBudget record component
    • memoryBudget

      public MemoryBudget memoryBudget()
      Returns the value of the memoryBudget record component.
      Returns:
      the value of the memoryBudget record component
    • threadBudget

      public ThreadBudget threadBudget()
      Returns the value of the threadBudget record component.
      Returns:
      the value of the threadBudget record component
    • queueBudget

      public QueueBudget queueBudget()
      Returns the value of the queueBudget record component.
      Returns:
      the value of the queueBudget record component