mirror of
https://github.com/corda/corda.git
synced 2024-12-29 09:18:58 +00:00
implement Thread.[get|set]ContextClassloader()
This commit is contained in:
parent
38d4ee6e07
commit
b56eed68be
@ -9,11 +9,14 @@ public class Thread implements Runnable {
|
|||||||
private Map<ThreadLocal, Object> locals;
|
private Map<ThreadLocal, Object> locals;
|
||||||
private boolean interrupted;
|
private boolean interrupted;
|
||||||
private Object sleepLock;
|
private Object sleepLock;
|
||||||
|
private ClassLoader classLoader;
|
||||||
|
|
||||||
public Thread(Runnable task) {
|
public Thread(Runnable task) {
|
||||||
this.task = task;
|
this.task = task;
|
||||||
|
|
||||||
Map<ThreadLocal, Object> map = currentThread().locals;
|
Thread current = currentThread();
|
||||||
|
|
||||||
|
Map<ThreadLocal, Object> map = current.locals;
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
for (Map.Entry<ThreadLocal, Object> e: map.entrySet()) {
|
for (Map.Entry<ThreadLocal, Object> e: map.entrySet()) {
|
||||||
if (e.getKey() instanceof InheritableThreadLocal) {
|
if (e.getKey() instanceof InheritableThreadLocal) {
|
||||||
@ -22,6 +25,8 @@ public class Thread implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
classLoader = current.classLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void start() {
|
public synchronized void start() {
|
||||||
@ -43,6 +48,14 @@ public class Thread implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ClassLoader getContextClassLoader() {
|
||||||
|
return classLoader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContextClassLoader(ClassLoader v) {
|
||||||
|
classLoader = v;
|
||||||
|
}
|
||||||
|
|
||||||
public Map<ThreadLocal, Object> locals() {
|
public Map<ThreadLocal, Object> locals() {
|
||||||
if (locals == null) {
|
if (locals == null) {
|
||||||
locals = new WeakHashMap();
|
locals = new WeakHashMap();
|
||||||
|
@ -1336,7 +1336,8 @@ Thread::Thread(Machine* m, object javaThread, Thread* parent):
|
|||||||
|
|
||||||
populateBuiltinMap(t, m->builtinMap);
|
populateBuiltinMap(t, m->builtinMap);
|
||||||
|
|
||||||
t->javaThread = makeThread(t, reinterpret_cast<int64_t>(t), 0, 0, 0, 0);
|
t->javaThread = makeThread
|
||||||
|
(t, reinterpret_cast<int64_t>(t), 0, 0, 0, 0, t->vm->loader);
|
||||||
} else {
|
} else {
|
||||||
threadPeer(this, javaThread) = reinterpret_cast<jlong>(this);
|
threadPeer(this, javaThread) = reinterpret_cast<jlong>(this);
|
||||||
parent->child = this;
|
parent->child = this;
|
||||||
|
@ -140,7 +140,8 @@
|
|||||||
(object task)
|
(object task)
|
||||||
(object locals)
|
(object locals)
|
||||||
(uint8_t interrupted)
|
(uint8_t interrupted)
|
||||||
(object sleepLock))
|
(object sleepLock)
|
||||||
|
(object classLoader))
|
||||||
|
|
||||||
(type stackTraceElement java/lang/StackTraceElement
|
(type stackTraceElement java/lang/StackTraceElement
|
||||||
(extends jobject)
|
(extends jobject)
|
||||||
|
Loading…
Reference in New Issue
Block a user