mirror of
https://github.com/corda/corda.git
synced 2025-06-13 04:38:19 +00:00
fix custom-classloader-related concurrency problems and other bugs
The main changes in this commit ensure that we don't hold the global class lock when doing class resolution using application-defined classloaders. Such classloaders may do their own locking (in fact, it's almost certain), making deadlock likely when mixed with VM-level locking in various orders. Other changes include a fix to avoid overflow when waiting for extremely long intervals and a GC root stack mapping bug.
This commit is contained in:
@ -15,7 +15,7 @@ import java.util.WeakHashMap;
|
||||
|
||||
public class Thread implements Runnable {
|
||||
private long peer;
|
||||
private boolean interrupted;
|
||||
private volatile boolean interrupted;
|
||||
private boolean daemon;
|
||||
private byte state;
|
||||
private byte priority;
|
||||
@ -141,25 +141,9 @@ public class Thread implements Runnable {
|
||||
|
||||
public static native Thread currentThread();
|
||||
|
||||
private static native void interrupt(long peer);
|
||||
public native void interrupt();
|
||||
|
||||
public synchronized void interrupt() {
|
||||
if (peer != 0) {
|
||||
interrupt(peer);
|
||||
} else {
|
||||
interrupted = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean interrupted() {
|
||||
Thread t = currentThread();
|
||||
|
||||
synchronized (t) {
|
||||
boolean v = t.interrupted;
|
||||
t.interrupted = false;
|
||||
return v;
|
||||
}
|
||||
}
|
||||
public native boolean interrupted();
|
||||
|
||||
public static boolean isInterrupted() {
|
||||
return currentThread().interrupted;
|
||||
|
Reference in New Issue
Block a user