44323
2023-09-16 a99684a9a4ecbdd71d1c93ef824f7741ff52c5d9
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();
    }
}