-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 #1430 WxMpConfigStorageHolder提供remove方法,方便使用者调用
- Loading branch information
1 parent
c184ae1
commit 07a1d26
Showing
1 changed file
with
11 additions
and
7 deletions.
There are no files selected for viewing
18 changes: 11 additions & 7 deletions
18
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/WxMpConfigStorageHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
package me.chanjar.weixin.mp.util; | ||
|
||
|
||
/** | ||
* @Author: yd | ||
* @Date: 2019-03-20 22:06 | ||
* @author yd | ||
* @date 2019-03-20 22:06 | ||
*/ | ||
public class WxMpConfigStorageHolder { | ||
|
||
private final static ThreadLocal<String> WX_MP_CONFIG_STORAGE_CHOSE = new ThreadLocal<String>() { | ||
private final static ThreadLocal<String> THREAD_LOCAL = new ThreadLocal<String>() { | ||
@Override | ||
protected String initialValue() { | ||
return "default"; | ||
} | ||
}; | ||
|
||
public static String get() { | ||
return WX_MP_CONFIG_STORAGE_CHOSE.get(); | ||
return THREAD_LOCAL.get(); | ||
} | ||
|
||
public static void set(String label) { | ||
WX_MP_CONFIG_STORAGE_CHOSE.set(label); | ||
THREAD_LOCAL.set(label); | ||
} | ||
|
||
/** | ||
* 此方法需要用户根据自己程序代码,在适当位置手动触发调用,本SDK里无法判断调用时机 | ||
*/ | ||
public static void remove() { | ||
THREAD_LOCAL.remove(); | ||
} | ||
} |