From 4850fe8183ae0aa58388d70bcd7d77d8b2a892b1 Mon Sep 17 00:00:00 2001 From: Brian Long Date: Tue, 1 Jun 2021 13:31:11 -0400 Subject: [PATCH] added hotswap plugin disable parameterization --- Dockerfile | 1 + README.md | 15 ++++++++------- hotswap-agent.properties | 2 +- setenv.sh | 1 + 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1b33292..d28c5c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ ENV JRE_HOME=/usr/local/lib/jvm/java-openjdk-dcevm ENV JAVA_OPTS= ENV ENABLE_HOTSWAP=true ENV ENABLE_JDWP=true +ENV DISABLE_HOTSWAP_PLUGINS= # Install curl RUN apt update && \ diff --git a/README.md b/README.md index c51576b..0b1adf5 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,11 @@ You may include your own `hotswap-agent.properties` in any of the `classes` fold You can specify the following environment variables when running the container. -| Environment Variable | Default Value | Description | -| -------------------- | ------------- | ----------- | -| `JAVA_MEMORY_INIT` | `128m` | The initial and minimum JVM memory. | -| `JAVA_MEMORY_MAX` | `512m` | The maximum JVM memory allowed. | -| `ENABLE_HOTSWAP` | `true` | Set to `false` to disable the HotSwap agent. | -| `ENABLE_JDWP` | `true` | Set to `false` to disable the Java debugger. | -| `JAVA_OPTS` | | Set to extend the standard `JAVA_OPTS` environment variable. | +| Environment Variable | Default Value | Description | +| ------------------------- | ------------- | ----------- | +| `JAVA_MEMORY_INIT` | `128m` | The initial and minimum JVM memory. | +| `JAVA_MEMORY_MAX` | `512m` | The maximum JVM memory allowed. | +| `ENABLE_HOTSWAP` | `true` | Set to `false` to disable the HotSwap agent. | +| `DISABLE_HOTSWAP_PLUGINS` | | Provide a comma-delimited list of HotSwap plugins to disable. You can find a list of those plugins here: https://github.com/HotswapProjects/HotswapAgent/tree/master/plugin. The name is only specified in the source, like [*Spring*](https://github.com/HotswapProjects/HotswapAgent/blob/master/plugin/hotswap-agent-spring-plugin/src/main/java/org/hotswap/agent/plugin/spring/SpringPlugin.java). | +| `ENABLE_JDWP` | `true` | Set to `false` to disable the Java debugger. | +| `JAVA_OPTS` | | Set to extend the standard `JAVA_OPTS` environment variable. | diff --git a/hotswap-agent.properties b/hotswap-agent.properties index d3ec568..17f33f8 100644 --- a/hotswap-agent.properties +++ b/hotswap-agent.properties @@ -45,7 +45,7 @@ webappDir= # Comma separated list of disabled plugins # Use plugin name - e.g. Hibernate, Spring, ZK, Hotswapper, AnonymousClassPatch, Tomcat, Logback .... -disabledPlugins= +disabledPlugins=${hotswap.disabledPlugins} # Watch for changed class files on watchResources path and reload class definition in the running application. # diff --git a/setenv.sh b/setenv.sh index 581bc40..3d0591c 100644 --- a/setenv.sh +++ b/setenv.sh @@ -3,6 +3,7 @@ JAVA_OPTS="${JAVA_OPTS} -Xms${JAVA_MEMORY_INIT} -Xmx${JAVA_MEMORY_MAX}" if [ "${ENABLE_HOTSWAP}" = "true" ]; then JAVA_OPTS="${JAVA_OPTS} -XX:HotswapAgent=external -javaagent:/usr/local/lib/jvm/hotswap-agent.jar" + JAVA_OPTS="${JAVA_OPTS} -Dhotswap.disablePlugins=${DISABLE_HOTSWAP_PLUGINS}" fi if [ "${ENABLE_JDWP}" = "true" ]; then