tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgallim...@apache.org
Subject tomee git commit: Expose deployer ejb reload method through JMX
Date Fri, 08 Apr 2016 09:12:52 GMT
Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x f226b31ab -> 56ebcce39


Expose deployer ejb reload method through JMX


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/56ebcce3
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/56ebcce3
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/56ebcce3

Branch: refs/heads/tomee-1.7.x
Commit: 56ebcce396838b394911c2641d79baa494341304
Parents: f226b31
Author: Jonathan Gallimore <jon@jrg.me.uk>
Authored: Fri Apr 8 10:12:14 2016 +0100
Committer: Jonathan Gallimore <jon@jrg.me.uk>
Committed: Fri Apr 8 10:12:14 2016 +0100

----------------------------------------------------------------------
 .../assembler/monitoring/JMXDeployer.java       | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/56ebcce3/container/openejb-core/src/main/java/org/apache/openejb/assembler/monitoring/JMXDeployer.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/monitoring/JMXDeployer.java
b/container/openejb-core/src/main/java/org/apache/openejb/assembler/monitoring/JMXDeployer.java
index c57ca81..f0cd7c2 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/monitoring/JMXDeployer.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/monitoring/JMXDeployer.java
@@ -72,7 +72,30 @@ public class JMXDeployer {
             return new String[]{"ERR:" + e.getMessage()};
         }
     }
+    @ManagedOperation
+    @Description("Reload the specified application")
+    public String reload(final String moduleId) {
+        try {
+        	final Collection<AppInfo> apps = deployer().getDeployedApps();
+        	boolean found = false;
+            for (final AppInfo info : apps) {
+                if (info.path.equals(moduleId)) {
+                	found = true;
+                }
+            }
+
+        	if (found) {
+        		deployer().reload(moduleId);
+                return "OK";
+        	} else {
+                return "NOT FOUND";
+        	}
 
+        } catch (final Exception e) {
+            return "ERR:" + e.getMessage();
+        }
+    }
+    
     private static Deployer deployer() throws NamingException {
         final Properties p = new Properties();
         p.setProperty(Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());


Mime
View raw message