Builder
public static final class Builder
源码Source
io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:334–436MongoSandboxExecutionGuard的构建器。位于 io.agentscope.extensions.mongodb.sandbox 包。核心成员包括 databaseName、collectionName、lockTimeout、leaseTtl、retryInterval、owner。
Builder for MongoSandboxExecutionGuard.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Builder databaseName(String databaseName) | 设置数据库名称。 Performs the database name operation. |
public Builder collectionName(String collectionName) | 设置集合名称。 Performs the collection name operation. |
public Builder lockTimeout(Duration timeout) | 设置锁超时。 Sets the maximum time to wait for acquiring the lock before `#tryEnter` throws
`InterruptedException`. |
public Builder leaseTtl(Duration ttl) | 设置该配置项。 Sets the lifetime of the lock document (`expiresAt`) written on acquisition. |
public Builder retryInterval(Duration interval) | 设置重试间隔。 Sets the polling interval between lock acquisition attempts. |
public Builder owner(String owner) | 设置所有者。 Sets a human-readable owner label for diagnostics. |
public MongoSandboxExecutionGuard build() | 构建并返回最终实例。 Creates and returns an instance. |
方法详情Method Detail
databaseName
public Builder databaseName(String databaseName)
设置数据库名称。
Performs the database name operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
databaseName | String | 数据库名称(类型 `String`)。The database name. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:351–354collectionName
public Builder collectionName(String collectionName)
设置集合名称。
Performs the collection name operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
collectionName | String | 集合名称(类型 `String`)。The collection name. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:356–359lockTimeout
public Builder lockTimeout(Duration timeout)
设置锁超时。
Sets the maximum time to wait for acquiring the lock before #tryEnter throws InterruptedException.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
timeout | Duration | 超时时间(类型 `Duration`)。the acquisition timeout; must be positive |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:371–378leaseTtl
public Builder leaseTtl(Duration ttl)
设置该配置项。
Sets the lifetime of the lock document (expiresAt) written on acquisition.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ttl | Duration | 存活时间(类型 `Duration`)。the lease TTL; must be positive |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:393–400retryInterval
public Builder retryInterval(Duration interval)
设置重试间隔。
Sets the polling interval between lock acquisition attempts.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
interval | Duration | 间隔(类型 `Duration`)。the retry interval; must be positive |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:411–418owner
public Builder owner(String owner)
设置所有者。
Sets a human-readable owner label for diagnostics.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
owner | String | 所有者标签。the owner label |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:428–431build
public MongoSandboxExecutionGuard build()
构建并返回最终实例。
Creates and returns an instance.
MongoSandboxExecutionGuard返回MongoSandboxExecutionGuard。Returns mongo sandbox execution guard.
源码Source
io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:433–435