AS AgentScopeAPI 手册 / API Reference

Builder

public static final class Builder
源码Source io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:334–436

MongoSandboxExecutionGuard的构建器。位于 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
databaseNameString数据库名称(类型 `String`)。The database name.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:351–354

collectionName

public Builder collectionName(String collectionName)

设置集合名称。

Performs the collection name operation.

参数Parameters
名称Name类型Type说明Description
collectionNameString集合名称(类型 `String`)。The collection name.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:356–359

lockTimeout

public Builder lockTimeout(Duration timeout)

设置锁超时。

Sets the maximum time to wait for acquiring the lock before #tryEnter throws InterruptedException.

参数Parameters
名称Name类型Type说明Description
timeoutDuration超时时间(类型 `Duration`)。the acquisition timeout; must be positive
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:371–378

leaseTtl

public Builder leaseTtl(Duration ttl)

设置该配置项。

Sets the lifetime of the lock document (expiresAt) written on acquisition.

参数Parameters
名称Name类型Type说明Description
ttlDuration存活时间(类型 `Duration`)。the lease TTL; must be positive
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:393–400

retryInterval

public Builder retryInterval(Duration interval)

设置重试间隔。

Sets the polling interval between lock acquisition attempts.

参数Parameters
名称Name类型Type说明Description
intervalDuration间隔(类型 `Duration`)。the retry interval; must be positive
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:411–418

owner

public Builder owner(String owner)

设置所有者。

Sets a human-readable owner label for diagnostics.

参数Parameters
名称Name类型Type说明Description
ownerString所有者标签。the owner label
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:428–431

build

public MongoSandboxExecutionGuard build()

构建并返回最终实例。

Creates and returns an instance.

返回Returns MongoSandboxExecutionGuard
返回MongoSandboxExecutionGuard。Returns mongo sandbox execution guard.
源码Source io/agentscope/extensions/mongodb/sandbox/MongoSandboxExecutionGuard.java:433–435
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.