puzhibing
2023-06-13 11b4c2cf16ff93e4e4955f88db3ae9c28d6f7782
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();
    }
}