mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
This commit is contained in:
parent
fdea722ab3
commit
c88155de85
@ -33,20 +33,26 @@ public class DataSourceKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void use(String dataSourceKey) {
|
public static void use(String dataSourceKey) {
|
||||||
lookup.get().push(dataSourceKey);
|
Deque<String> deque = lookup.get();
|
||||||
|
if (deque != null) {
|
||||||
|
deque.push(dataSourceKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String get() {
|
public static String get() {
|
||||||
return lookup.get().peek();
|
Deque<String> deque = lookup.get();
|
||||||
|
return deque != null ? deque.peek() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clear() {
|
public static void clear() {
|
||||||
Deque<String> deque = lookup.get();
|
Deque<String> deque = lookup.get();
|
||||||
|
if (deque != null) {
|
||||||
deque.pop();
|
deque.pop();
|
||||||
if (deque.isEmpty()) {
|
if (deque.isEmpty()) {
|
||||||
lookup.remove();
|
lookup.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void forceClear() {
|
public static void forceClear() {
|
||||||
lookup.remove();
|
lookup.remove();
|
||||||
@ -89,18 +95,22 @@ public class DataSourceKey {
|
|||||||
public static String getByManual() {
|
public static String getByManual() {
|
||||||
throw new UnsupportedOperationException("使用 DataSource.get() 代替。");
|
throw new UnsupportedOperationException("使用 DataSource.get() 代替。");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static String getByAnnotation() {
|
public static String getByAnnotation() {
|
||||||
throw new UnsupportedOperationException("使用 DataSource.get() 代替。");
|
throw new UnsupportedOperationException("使用 DataSource.get() 代替。");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void useWithAnnotation(String dataSourceKey) {
|
public static void useWithAnnotation(String dataSourceKey) {
|
||||||
throw new UnsupportedOperationException("使用 DataSource.use(String) 代替。");
|
throw new UnsupportedOperationException("使用 DataSource.use(String) 代替。");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setAnnotationKeyThreadLocal(ThreadLocal<String> annotationKeyThreadLocal) {
|
public static void setAnnotationKeyThreadLocal(ThreadLocal<String> annotationKeyThreadLocal) {
|
||||||
throw new UnsupportedOperationException("使用 DataSource.setThreadLocal(ThreadLocal<Deque<String>>) 代替。");
|
throw new UnsupportedOperationException("使用 DataSource.setThreadLocal(ThreadLocal<Deque<String>>) 代替。");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setManualKeyThreadLocal(ThreadLocal<String> manualKeyThreadLocal) {
|
public static void setManualKeyThreadLocal(ThreadLocal<String> manualKeyThreadLocal) {
|
||||||
throw new UnsupportedOperationException("使用 DataSource.setThreadLocal(ThreadLocal<Deque<String>>) 代替。");
|
throw new UnsupportedOperationException("使用 DataSource.setThreadLocal(ThreadLocal<Deque<String>>) 代替。");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user