using Serein.Library.Api;
using Serein.Library.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Serein.Library
{
///
/// 轻量级流程控制器
///
public class LightweightFlowControl : IFlowControl
{
private readonly IFlowCallTree flowCallTree;
private readonly IFlowEnvironment flowEnvironment;
///
/// 轻量级流程上下文池,使用对象池模式来管理流程上下文的创建和回收。
///
public static Serein.Library.Utils.ObjectPool FlowContextPool { get; set; }
///
/// 单例IOC容器,用于依赖注入和服务定位。
///
public ISereinIOC IOC => throw new NotImplementedException();
///
/// 轻量级流程控制器构造函数,接受流程调用树和流程环境作为参数。
///
///
///
public LightweightFlowControl(IFlowCallTree flowCallTree, IFlowEnvironment flowEnvironment)
{
this.flowCallTree = flowCallTree;
this.flowEnvironment = flowEnvironment;
((LightweightFlowEnvironment)flowEnvironment).FlowControl = this;
FlowContextPool = new Utils.ObjectPool(() =>
{
return new FlowContext(flowEnvironment);
}, context =>
{
context.Reset();
});
}
///
public Task