mirror of
https://gitee.com/dromara/sa-token.git
synced 2024-11-30 02:48:10 +08:00
SaTokenDao 新增默认方法 onChange,当 SaManager.saTokenDao 变更时,调用该方法
This commit is contained in:
parent
f2416a6175
commit
8db78e0a5d
@ -102,8 +102,8 @@ public class SaManager {
|
||||
SaTokenEventCenter.doRegisterComponent("SaTokenDao", saTokenDao);
|
||||
}
|
||||
private static void setSaTokenDaoMethod(SaTokenDao saTokenDao) {
|
||||
if((SaManager.saTokenDao instanceof SaTokenDaoDefaultImpl)) {
|
||||
((SaTokenDaoDefaultImpl)SaManager.saTokenDao).endRefreshThread();
|
||||
if (SaManager.saTokenDao != null) {
|
||||
SaManager.saTokenDao.onChange();
|
||||
}
|
||||
SaManager.saTokenDao = saTokenDao;
|
||||
}
|
||||
|
@ -201,4 +201,11 @@ public interface SaTokenDao {
|
||||
List<String> searchData(String prefix, String keyword, int start, int size, boolean sortType);
|
||||
|
||||
|
||||
// --------------------- 实例相关 ---------------------
|
||||
|
||||
/**
|
||||
* 当 SaManager.saTokenDao 变更时,调用该方法
|
||||
*/
|
||||
default void onChange() {
|
||||
}
|
||||
}
|
||||
|
@ -264,8 +264,8 @@ public class SaTokenDaoDefaultImpl implements SaTokenDao {
|
||||
/**
|
||||
* 结束定时任务,不再定时清理过期数据
|
||||
*/
|
||||
public void endRefreshThread() {
|
||||
@Override
|
||||
public void onChange() {
|
||||
this.refreshFlag = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user