static cleanup
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/4deaec5c Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/4deaec5c Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/4deaec5c Branch: refs/heads/master Commit: 4deaec5c4d259f1a28bf1a299852af5f0416a0f4 Parents: 9a4e6fd Author: Romain Manni-Bucau <rmann...@gmail.com> Authored: Tue Dec 1 18:50:47 2015 +0100 Committer: Romain Manni-Bucau <rmann...@gmail.com> Committed: Tue Dec 1 18:50:47 2015 +0100 ---------------------------------------------------------------------- .../catalina/cluster/TomEEClusterListener.java | 44 ++++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/4deaec5c/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/cluster/TomEEClusterListener.java ---------------------------------------------------------------------- diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/cluster/TomEEClusterListener.java b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/cluster/TomEEClusterListener.java index 26e0037..63ccea0 100644 --- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/cluster/TomEEClusterListener.java +++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/cluster/TomEEClusterListener.java @@ -31,14 +31,14 @@ import org.apache.openejb.util.DaemonThreadFactory; import org.apache.openejb.util.LogCategory; import org.apache.openejb.util.Logger; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; import java.io.File; import java.util.Properties; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; public class TomEEClusterListener extends ClusterListener { @Override @@ -65,33 +65,33 @@ public class TomEEClusterListener extends ClusterListener { file = dump.getAbsolutePath(); ioFile = new File(file); - Static.STATIC.LOGGER.info("dumped archive: " + msg.getFile() + " to " + file); + Static.LOGGER.info("dumped archive: " + msg.getFile() + " to " + file); } catch (final Exception e) { - Static.STATIC.LOGGER.error("can't dump archive: "+ file, e); + Static.LOGGER.error("can't dump archive: "+ file, e); } } if (ioFile.exists()) { - Static.STATIC.SERVICE.submit(new DeployTask(file)); + Static.SERVICE.submit(new DeployTask(file)); } else { - Static.STATIC.LOGGER.warning("can't find '" + file); + Static.LOGGER.warning("can't find '" + file); } } else { - Static.STATIC.LOGGER.info("application already deployed: " + file); + Static.LOGGER.info("application already deployed: " + file); } } else if (UndeployMessage.class.equals(type)) { final String file = ((UndeployMessage) clusterMessage).getFile(); if (isDeployed(file)) { - Static.STATIC.SERVICE.submit(new UndeployTask(file)); + Static.SERVICE.submit(new UndeployTask(file)); } else { final File alternativeFile = new File(deployedDir(), new File(file).getName()); if (isDeployed(alternativeFile.getAbsolutePath())) { - Static.STATIC.SERVICE.submit(new UndeployTask(alternativeFile.getAbsolutePath())); + Static.SERVICE.submit(new UndeployTask(alternativeFile.getAbsolutePath())); } - Static.STATIC.LOGGER.info("app '" + file + "' was not deployed"); + Static.LOGGER.info("app '" + file + "' was not deployed"); } } else { - Static.STATIC.LOGGER.warning("message type not supported: " + type); + Static.LOGGER.warning("message type not supported: " + type); } } @@ -104,7 +104,7 @@ public class TomEEClusterListener extends ClusterListener { } private static Deployer deployer() throws NamingException { - return (Deployer) new InitialContext(Static.STATIC.IC_PROPS).lookup("openejb/DeployerBusinessRemote"); + return (Deployer) new InitialContext(Static.IC_PROPS).lookup("openejb/DeployerBusinessRemote"); } @Override @@ -115,11 +115,11 @@ public class TomEEClusterListener extends ClusterListener { } public static void stop() { - Static.STATIC.SERVICE.shutdown(); + Static.SERVICE.shutdown(); try { - Static.STATIC.SERVICE.awaitTermination(1, TimeUnit.MINUTES); + Static.SERVICE.awaitTermination(1, TimeUnit.MINUTES); } catch (final InterruptedException e) { - Static.STATIC.SERVICE.shutdownNow(); + Static.SERVICE.shutdownNow(); } } @@ -140,9 +140,9 @@ public class TomEEClusterListener extends ClusterListener { try { deployer().deploy(app, REMOTE_DEPLOY_PROPERTIES); } catch (final OpenEJBException e) { - Static.STATIC.LOGGER.warning("can't deploy: " + app, e); + Static.LOGGER.warning("can't deploy: " + app, e); } catch (final NamingException e) { - Static.STATIC.LOGGER.warning("can't find deployer", e); + Static.LOGGER.warning("can't find deployer", e); } } } @@ -161,11 +161,11 @@ public class TomEEClusterListener extends ClusterListener { try { deployer().undeploy(app); } catch (final UndeployException e) { - Static.STATIC.LOGGER.error("can't undeploy app", e); + Static.LOGGER.error("can't undeploy app", e); } catch (final NoSuchApplicationException e) { - Static.STATIC.LOGGER.warning("no app toi deploy", e); + Static.LOGGER.warning("no app toi deploy", e); } catch (final NamingException e) { - Static.STATIC.LOGGER.warning("can't find deployer", e); + Static.LOGGER.warning("can't find deployer", e); } } } @@ -173,8 +173,6 @@ public class TomEEClusterListener extends ClusterListener { // lazy init of logger (can fail with shutdown hooks to kill the container) and executor private static final class Static { - private static final Static STATIC = new Static(); - private static final Logger LOGGER = Logger.getInstance(LogCategory.OPENEJB, TomEEClusterListener.class); private static final Properties IC_PROPS = new Properties();