// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextScopes.java
// public final class ContextScopes {
// 
//     public static final String THREAD = "lep.system.thread";
// 
//     public static final String EXECUTION = "lep.system.execution";
// 
//     /**
//      * Private utils class constructor, to prevent instantiation with reflection API.
//      */
//     private ContextScopes() {
//         throw new IllegalAccessError("not permitted access for utils class");
//     }
// 
// }
// 
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextsHolder.java
// public interface ContextsHolder {
// 
//     /**
//      * Return context instance by scope name.
//      *
//      * @param scope context scope name, this name is unique across all
//      *              scopes in one {@link ContextsHolder} instance
//      * @return context instance
//      * @see ContextScopes
//      */
//     ScopedContext getContext(String scope);
// 
// }
// 
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ScopedContext.java
// public interface ScopedContext extends Context {
// 
//     String getScope();
// 
// }


import com.icthh.xm.lep.api.ContextScopes;
import com.icthh.xm.lep.api.ContextsHolder;
import com.icthh.xm.lep.api.ScopedContext;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
package com.icthh.xm.lep.core;



/**
 * The {@link CoreContextsHolder} class.
 */
public class CoreContextsHolder implements ContextsHolder {

    private static volatile Map<String, ThreadLocal<ScopedContext>> contexts = new HashMap<>();

    static {
        contexts.put(ContextScopes.THREAD, new ThreadLocal<>());
        contexts.put(ContextScopes.EXECUTION, new ThreadLocal<>());
    }

    private static ThreadLocal<ScopedContext> getThreadLocalContext(String scope) {
        return contexts.get(scope);
    }

    @Override
    public ScopedContext getContext(String scope) {
        Objects.requireNonNull(scope, "scope can't be null");

// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextScopes.java
// public final class ContextScopes {
// 
//     public static final String THREAD = "lep.system.thread";
// 
//     public static final String EXECUTION = "lep.system.execution";
// 
//     /**
//      * Private utils class constructor, to prevent instantiation with reflection API.
//      */
//     private ContextScopes() {
//         throw new IllegalAccessError("not permitted access for utils class");
//     }
// 
// }
// 
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextsHolder.java
// public interface ContextsHolder {
// 
//     /**
//      * Return context instance by scope name.
//      *
//      * @param scope context scope name, this name is unique across all
//      *              scopes in one {@link ContextsHolder} instance
//      * @return context instance
//      * @see ContextScopes
//      */
//     ScopedContext getContext(String scope);
// 
// }
// 
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ScopedContext.java
// public interface ScopedContext extends Context {
// 
//     String getScope();
// 
// }


// Path: xm-lep-core/src/main/java/com/icthh/xm/lep/core/CoreContextsHolder.java
import com.icthh.xm.lep.api.ContextScopes;
import com.icthh.xm.lep.api.ContextsHolder;
import com.icthh.xm.lep.api.ScopedContext;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

package com.icthh.xm.lep.core;



/**
 * The {@link CoreContextsHolder} class.
 */
public class CoreContextsHolder implements ContextsHolder {

    private static volatile Map<String, ThreadLocal<ScopedContext>> contexts = new HashMap<>();

    static {
        contexts.put(ContextScopes.THREAD, new ThreadLocal<>());
        contexts.put(ContextScopes.EXECUTION, new ThreadLocal<>());
    }

    private static ThreadLocal<ScopedContext> getThreadLocalContext(String scope) {
        return contexts.get(scope);
    }

    @Override
    public ScopedContext getContext(String scope) {
        Objects.requireNonNull(scope, "scope can't be null");

        ThreadLocal<ScopedContext> threadLocalContext = getThreadLocalContext(scope);