AS AgentScopeAPI 手册 / API Reference

ServiceWithLifecycleManager

public abstract class ServiceWithLifecycleManager implements Service
源码Source io/agentscope/runtime/engine/services/ServiceWithLifecycleManager.java:51–72

服务使用生命周期管理器,承载智能体的部署、调度与服务化运行。位于 io.agentscope.runtime.engine.services 包,实现 Service。核心成员包括 start、stop、health。

Base class for services that want lifecycle manager functionality.

This class combines the Service interface with default implementations for common lifecycle operations, providing a convenient base class for most service implementations.

Note: This is an abstract base class. Subclasses must implement the abstract methods from the Service interface.

Usage Example:

`public class MyService extends ServiceWithLifecycleManager {
@Override
public CompletableFuture<Void> start() {
// Initialize resources
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<Void> stop() {
// Cleanup resources
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<Boolean> health() {
return CompletableFuture.completedFuture(true);
}
}
`

方法摘要Method Summary

方法Method说明Description
public abstract void start()
abstract
执行启动相关操作。
Starts the service, initializing any necessary resources or connections.
public abstract void stop()
abstract
执行停止相关操作。
Stops the service, releasing any acquired resources.
public abstract boolean health()
abstract
检查健康状态的服务。
Checks the health of the service.

方法详情Method Detail

start

public abstract void start()
abstract

执行启动相关操作。

Starts the service, initializing any necessary resources or connections.

源码Source io/agentscope/runtime/engine/services/ServiceWithLifecycleManager.java:56–57

stop

public abstract void stop()
abstract

执行停止相关操作。

Stops the service, releasing any acquired resources.

源码Source io/agentscope/runtime/engine/services/ServiceWithLifecycleManager.java:62–63

health

public abstract boolean health()
abstract

检查健康状态的服务。

Checks the health of the service.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/runtime/engine/services/ServiceWithLifecycleManager.java:70–71
基于官方固定版本源码静态生成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.