86183
2022-09-09 0d999e33085c0a25c5525242748f6aa62a401159
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();
    }
}