You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
631 B
25 lines
631 B
4 years ago
|
A call which may execute arbitrary code (such as registered, or chained, callbacks) is made while a lock is held.
|
||
|
This code may deadlock whenever the callbacks obtain locks themselves, so it is an unsafe pattern.
|
||
|
This warning is issued only at the innermost lock acquisition around the final call.
|
||
|
|
||
|
Example:
|
||
|
```java
|
||
|
public class NotUnderLock {
|
||
|
SettableFuture future = null;
|
||
|
|
||
|
public void callFutureSetOk() {
|
||
|
future.set(null);
|
||
|
}
|
||
|
|
||
|
public synchronized void firstAcquisitionBad() {
|
||
|
callFutureSetOk();
|
||
|
}
|
||
|
|
||
|
public void secondAcquisitionOk(Object o) {
|
||
|
synchronized (o) {
|
||
|
firstAcquisitionBad();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
```
|