Skip to content

Commit 828bf1a

Browse files
committed
优化 solon-java25 ScopeLocal 的 warn 日志,添加 applyFor 信息
1 parent 2ecd595 commit 828bf1a

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/main/java/org/noear/solon/util/ScopeLocalJdk25.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88

99
public class ScopeLocalJdk25<T> implements ScopeLocal<T> {
1010
private static final Logger log = LoggerFactory.getLogger(ScopeLocalJdk25.class);
11-
private final ScopedValue<T> ref = ScopedValue.newInstance();
1211

13-
public ScopeLocalJdk25() {
12+
private final ScopedValue<T> ref = ScopedValue.newInstance();
13+
private final Class<?> applyFor;
1414

15-
}
1615

1716
public ScopeLocalJdk25(Class<?> applyFor) {
18-
17+
this.applyFor = applyFor;
1918
}
2019

2120
@Override
@@ -51,13 +50,13 @@ public <R, X extends Throwable> R with(T value, FunctionTx<T, ? extends R, X> fu
5150

5251
@Override
5352
public void set(T value) {
54-
log.error("ScopeLocal.set is invalid, please use ScopeLocal.with");
53+
log.error("ScopeLocal.set is invalid, please use ScopeLocal.with. applyFor: {}", applyFor.getName());
5554
throw new UnsupportedOperationException();
5655
}
5756

5857
@Override
5958
public void remove() {
60-
log.error("ScopeLocal.remove is invalid, please use ScopeLocal.with");
59+
log.error("ScopeLocal.remove is invalid, please use ScopeLocal.with. applyFor: {}", applyFor.getName());
6160
throw new UnsupportedOperationException();
6261
}
6362
}

0 commit comments

Comments
 (0)