Package com.tnsai.quality.sandbox
Class SandboxPool.Lease
java.lang.Object
com.tnsai.quality.sandbox.SandboxPool.Lease
- All Implemented Interfaces:
Sandbox,AutoCloseable
- Enclosing class:
SandboxPool
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Returns the sandbox to the pool.Runcommandto completion (or until the sandbox kills it for exceedingResourceLimits.timeout).spec()TheSandboxSpecthis instance was created from.voidstop()Graceful shutdown.voidTerminates the underlying sandbox and removes it from the pool — useclose()to return it for reuse.
-
Method Details
-
spec
Description copied from interface:SandboxTheSandboxSpecthis instance was created from. Useful for downstream tooling (audit, observability) that needs to record the configured policy alongside the result. -
execute
Description copied from interface:SandboxRuncommandto completion (or until the sandbox kills it for exceedingResourceLimits.timeout). Always returns aSandboxResult; failures inside the sandbox are reflected inSandboxResult.exitCodeandSandboxResult.stderr, not thrown.Throws if the sandbox itself has been terminated, or if the backend layer cannot dispatch the command (image missing, runtime crash). Those are infrastructure failures, distinct from "the user's command exited non-zero".
-
stop
public void stop()Description copied from interface:SandboxGraceful shutdown. Backends SHOULD send SIGTERM (or the platform equivalent), wait a short grace period, then promote toSandbox.terminate()if the process is still running. -
terminate
public void terminate()Terminates the underlying sandbox and removes it from the pool — useclose()to return it for reuse. -
close
public void close()Returns the sandbox to the pool. Idempotent.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSandbox
-