package cn.axzo.workflow.core.common.utils;

import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner;
import com.alibaba.ttl.TransmittableThreadLocal;

/**
 * 线程本地变量表
 *
 * @author wangli
 * @since 2023/11/18 21:42
 */
public class ContextHolder {

    private static final TransmittableThreadLocal<BpmnTaskDelegateAssigner> CONTEXT = new TransmittableThreadLocal<>();

    private ContextHolder() {}

    public static void set(BpmnTaskDelegateAssigner assigner) {
        CONTEXT.set(assigner);
    }

    public static BpmnTaskDelegateAssigner get() {
        return CONTEXT.get();
    }

    public static void clear() {
        CONTEXT.remove();
    }
}
