All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.es.plus.adapter.interceptor.InterceptorLocalContext Maven / Gradle / Ivy

There is a newer version: 0.3.941
Show newest version
package com.es.plus.adapter.interceptor;

/**
 * 拦截器本地上下文
 *
 * @author hzh
 * @date 2023/12/19
 */
public class InterceptorLocalContext {
    
    private static final ThreadLocal LOCAL_CONTEXT = new ThreadLocal<>();
    
    public static void enable() {
        LOCAL_CONTEXT.set(true);
    }
    
    public static void disable() {
        LOCAL_CONTEXT.set(false);
    }
    public static Boolean get() {
       return LOCAL_CONTEXT.get();
    }
    public static void remove() {
        LOCAL_CONTEXT.remove();
    }
    
    public static void main(String[] args) {
        Boolean aBoolean = LOCAL_CONTEXT.get();
    
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy