From 0962dd07836d66bad3783303b7a557a3b7ffda17 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 16 Mar 2018 09:25:36 -0300 Subject: [PATCH] IDEMPIERE-3653 Hazelcast improvements / include some missing entries on template for aws discovery - change System.out to use logger --- org.adempiere.server-feature/hazelcast-template.xml | 3 +++ org.idempiere.hazelcast.service.config/hazelcast.xml | 3 +++ org.idempiere.hazelcast.service/META-INF/MANIFEST.MF | 1 + .../org/idempiere/hazelcast/service/Activator.java | 11 ++++++++--- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/org.adempiere.server-feature/hazelcast-template.xml b/org.adempiere.server-feature/hazelcast-template.xml index 68de459907..d18084f2e2 100644 --- a/org.adempiere.server-feature/hazelcast-template.xml +++ b/org.adempiere.server-feature/hazelcast-template.xml @@ -29,6 +29,9 @@ @ADEMPIERE_DB_PASSWORD@ http://localhost:8080/mancenter + + false + 5701 diff --git a/org.idempiere.hazelcast.service.config/hazelcast.xml b/org.idempiere.hazelcast.service.config/hazelcast.xml index 2a35dfb6e8..c101dfabb4 100644 --- a/org.idempiere.hazelcast.service.config/hazelcast.xml +++ b/org.idempiere.hazelcast.service.config/hazelcast.xml @@ -29,6 +29,9 @@ dev-pass http://localhost:8080/mancenter + + false + 5701 diff --git a/org.idempiere.hazelcast.service/META-INF/MANIFEST.MF b/org.idempiere.hazelcast.service/META-INF/MANIFEST.MF index 331272f59d..949be7fc42 100644 --- a/org.idempiere.hazelcast.service/META-INF/MANIFEST.MF +++ b/org.idempiere.hazelcast.service/META-INF/MANIFEST.MF @@ -20,6 +20,7 @@ Import-Package: javax.crypto, org.adempiere.base, org.compiere, org.compiere.model, + org.compiere.util, org.idempiere.distributed, org.osgi.framework;version="1.3.0", org.slf4j;version="1.6.1", diff --git a/org.idempiere.hazelcast.service/src/org/idempiere/hazelcast/service/Activator.java b/org.idempiere.hazelcast.service/src/org/idempiere/hazelcast/service/Activator.java index 1c3c22a1f4..6e5e9a0120 100644 --- a/org.idempiere.hazelcast.service/src/org/idempiere/hazelcast/service/Activator.java +++ b/org.idempiere.hazelcast.service/src/org/idempiere/hazelcast/service/Activator.java @@ -24,6 +24,7 @@ import java.util.Enumeration; import org.compiere.Adempiere; import org.compiere.model.ServerStateChangeEvent; import org.compiere.model.ServerStateChangeListener; +import org.compiere.util.CLogger; import org.eclipse.osgi.framework.console.CommandProvider; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; @@ -43,6 +44,7 @@ import com.hazelcast.core.HazelcastInstance; public class Activator implements BundleActivator { private static BundleContext context; + protected final static CLogger logger = CLogger.getCLogger(Activator.class.getName()); static BundleContext getContext() { return context; @@ -120,10 +122,11 @@ public class Activator implements BundleActivator { try { Config config = new FileSystemXmlConfig(file); config.setClassLoader(Activator.class.getClassLoader()); + logger.warning("Starting hazelcast with configuration from file " + file.getName()); hazelcastInstance = Hazelcast.newHazelcastInstance(config); MapConfig mc = config.getMapConfig("default"); if (mc != null) { - System.out.println("Hazelcast Max Size Config: "+mc.getMaxSizeConfig().getMaxSizePolicy() + " " + mc.getMaxSizeConfig().getSize()); + logger.info("Hazelcast Max Size Config: "+mc.getMaxSizeConfig().getMaxSizePolicy() + " " + mc.getMaxSizeConfig().getSize()); } return; } catch (FileNotFoundException e) {} @@ -135,10 +138,11 @@ public class Activator implements BundleActivator { try { Config config = new UrlXmlConfig(url); config.setClassLoader(Activator.class.getClassLoader()); + logger.warning("Starting hazelcast with configuration from URL " + url.toString()); hazelcastInstance = Hazelcast.newHazelcastInstance(config); MapConfig mc = config.getMapConfig("default"); if (mc != null) { - System.out.println("Hazelcast Max Size Config: "+mc.getMaxSizeConfig().getMaxSizePolicy() + " " + mc.getMaxSizeConfig().getSize()); + logger.info("Hazelcast Max Size Config: "+mc.getMaxSizeConfig().getMaxSizePolicy() + " " + mc.getMaxSizeConfig().getSize()); } return; } catch (IOException e) {} @@ -147,9 +151,10 @@ public class Activator implements BundleActivator { Config config = new Config(); config.setClassLoader(Activator.class.getClassLoader()); hazelcastInstance = Hazelcast.newHazelcastInstance(config); + logger.warning("Starting hazelcast with default configuration"); MapConfig mc = config.getMapConfig("default"); if (mc != null) { - System.out.println("Hazelcast Max Size Config: "+mc.getMaxSizeConfig().getMaxSizePolicy() + " " + mc.getMaxSizeConfig().getSize()); + logger.info("Hazelcast Max Size Config: "+mc.getMaxSizeConfig().getMaxSizePolicy() + " " + mc.getMaxSizeConfig().getSize()); } }