Skip to content

Commit 78237c5

Browse files
committed
Cleanup
1 parent f40cbdc commit 78237c5

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

platform_api/src/main/java/net/modfest/platform/misc/ThreadLocalHack.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,6 @@ public static <T> T getValueOfOtherThread(ThreadLocal<T> threadLocal, Thread thr
99
Method m = ThreadLocal.class.getDeclaredMethod("get", Thread.class);
1010
m.setAccessible(true);
1111
return (T)m.invoke(threadLocal, thread);
12-
// // https://stackoverflow.com/questions/5180114/threadlocal-value-access-across-different-threads
13-
// Field field = Thread.class.getDeclaredField("threadLocals");
14-
// field.setAccessible(true);
15-
// Object map = field.get(thread);
16-
//
17-
// Method method = null;
18-
// method = Class.forName("java.lang.ThreadLocal$ThreadLocalMap").getDeclaredMethod("getEntry", ThreadLocal.class);
19-
//
20-
// method.setAccessible(true);
21-
// WeakReference<?> entry = (WeakReference<?>)method.invoke(map, threadLocal);
22-
//
23-
// Field valueField = Class.forName("java.lang.ThreadLocal$ThreadLocalMap$Entry").getDeclaredField("value");
24-
// valueField.setAccessible(true);
25-
// Object value = valueField.get(entry);
26-
//
27-
// return (T)value;
2812
} catch (NoSuchMethodException | InvocationTargetException |
2913
IllegalAccessException e) {
3014
throw new RuntimeException(e);

0 commit comments

Comments
 (0)