diff --git a/README.md b/README.md
index bead308..abf8812 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# ja-netfilter v2.2.1
+# ja-netfilter v2.2.2
### A javaagent framework
@@ -62,4 +62,5 @@ EQUAL,somedomain
* download the jar file of the plugin
* put it in the subdirectory called `plugins` where the ja-netfilter.jar file is located
* enjoy the new capabilities brought by the plugin
+ * if the file suffix is `.disabled.jar`, the plugin will be disabled
diff --git a/pom.xml b/pom.xml
index d34c09f..6fdba67 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.ja-netfilter
ja-netfilter
- 2.2.1
+ 2.2.2
ja-netfilter
A javaagent framework
diff --git a/src/main/java/com/janetfilter/core/Environment.java b/src/main/java/com/janetfilter/core/Environment.java
index 1afaa24..39fce0c 100644
--- a/src/main/java/com/janetfilter/core/Environment.java
+++ b/src/main/java/com/janetfilter/core/Environment.java
@@ -15,6 +15,7 @@ public final class Environment {
private final File pluginsDir;
private final File logsDir;
private final String nativePrefix;
+ private final String disabledPluginSuffix;
public Environment(File agentFile) {
this(agentFile, null);
@@ -39,6 +40,7 @@ public final class Environment {
pid = ProcessUtils.currentId();
version = Launcher.VERSION;
nativePrefix = StringUtils.randomMethodName(15) + "_";
+ disabledPluginSuffix = ".disabled.jar";
}
public String getPid() {
@@ -77,6 +79,10 @@ public final class Environment {
return nativePrefix;
}
+ public String getDisabledPluginSuffix() {
+ return disabledPluginSuffix;
+ }
+
@Override
public String toString() {
return "Environment: {" +
@@ -89,6 +95,7 @@ public final class Environment {
", \n\tpluginsDir = " + pluginsDir +
", \n\tlogsDir = " + logsDir +
", \n\tnativePrefix = " + nativePrefix +
+ ", \n\tdisabledPluginSuffix = " + disabledPluginSuffix +
"\n}";
}
}
diff --git a/src/main/java/com/janetfilter/core/Launcher.java b/src/main/java/com/janetfilter/core/Launcher.java
index 0251f68..33fb8ad 100644
--- a/src/main/java/com/janetfilter/core/Launcher.java
+++ b/src/main/java/com/janetfilter/core/Launcher.java
@@ -12,7 +12,7 @@ import java.util.jar.JarFile;
public class Launcher {
public static final String ATTACH_ARG = "--attach";
- public static final String VERSION = "v2.2.1";
+ public static final String VERSION = "v2.2.2";
private static boolean loaded = false;
diff --git a/src/main/java/com/janetfilter/core/plugin/PluginManager.java b/src/main/java/com/janetfilter/core/plugin/PluginManager.java
index 54c1a53..c29d86f 100644
--- a/src/main/java/com/janetfilter/core/plugin/PluginManager.java
+++ b/src/main/java/com/janetfilter/core/plugin/PluginManager.java
@@ -68,6 +68,11 @@ public final class PluginManager {
@Override
public void run() {
try {
+ if (pluginFile.getName().endsWith(environment.getDisabledPluginSuffix())) {
+ DebugInfo.debug("Disabled plugin: " + pluginFile + ", ignored.");
+ return;
+ }
+
JarFile jarFile = new JarFile(pluginFile);
Manifest manifest = jarFile.getManifest();
String entryClass = manifest.getMainAttributes().getValue(ENTRY_NAME);