puzhibing
2024-02-05 640ff18d2d7f4be02ddb7f8f75e899f05545eb98
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package cn.mb.cloud.gateway.handler;
 
import com.alibaba.ttl.TransmittableThreadLocal;
 
public class AppTypeContextHolder {
 
    private final static ThreadLocal<String> DEVEICE_LOCAL = new TransmittableThreadLocal<>();
 
    public final static  String APP_TYPE="AppType";
 
    /**
     * 上下文中获取当
     * @param tenantId
     */
    public static void setDeviceType(String tenantId) {
        DEVEICE_LOCAL.set(tenantId);
    }
 
 
    public static String getDeviceType() {
        return DEVEICE_LOCAL.get();
    }
 
    public static void clear() {
        DEVEICE_LOCAL.remove();
    }
}