Class MongoSandboxExecutionGuard.Builder
java.lang.Object
io.agentscope.extensions.mongodb.sandbox.MongoSandboxExecutionGuard.Builder
- Enclosing class:
- MongoSandboxExecutionGuard
Builder for
MongoSandboxExecutionGuard.-
Method Summary
Modifier and TypeMethodDescriptionbuild()collectionName(String collectionName) databaseName(String databaseName) Sets the lifetime of the lock document (expiresAt) written on acquisition.lockTimeout(Duration timeout) Sets the maximum time to wait for acquiring the lock beforeMongoSandboxExecutionGuard.tryEnter(io.agentscope.harness.agent.sandbox.SandboxIsolationKey)throwsInterruptedException.Sets a human-readable owner label for diagnostics.retryInterval(Duration interval) Sets the polling interval between lock acquisition attempts.
-
Method Details
-
databaseName
-
collectionName
-
lockTimeout
Sets the maximum time to wait for acquiring the lock beforeMongoSandboxExecutionGuard.tryEnter(io.agentscope.harness.agent.sandbox.SandboxIsolationKey)throwsInterruptedException. This bounds queueing delay only; it does NOT bound the lock's lifetime — that is controlled byleaseTtl(Duration).Default:
30 minutes.- Parameters:
timeout- the acquisition timeout; must be positive- Returns:
- this builder
-
leaseTtl
Sets the lifetime of the lock document (expiresAt) written on acquisition. While the returned lease is open, a background watchdog renews the lease everyleaseTtl / 3, so executions longer than the TTL keep holding their lock. The TTL only matters when the holder dies without releasing: afterleaseTtlthe lock becomes eligible for reclamation by the next caller (MongoDB's TTL monitor may take up to 60 additional seconds to delete the document).Default:
30 minutes.- Parameters:
ttl- the lease TTL; must be positive- Returns:
- this builder
-
retryInterval
Sets the polling interval between lock acquisition attempts.Default:
500 ms. Lower values reduce latency at the cost of more MongoDB round-trips; higher values reduce load at the cost of increased queuing delay.- Parameters:
interval- the retry interval; must be positive- Returns:
- this builder
-
owner
Sets a human-readable owner label for diagnostics. The owner is stored in the lock document for visibility but is NOT used for renewal or release filtering — a random UUID token is used instead to guarantee uniqueness across guard instances.- Parameters:
owner- the owner label- Returns:
- this builder
-
build
-