IDEMPIERE-3653 Hazelcast improvements / include some missing entries on template for aws discovery - change System.out to use logger

This commit is contained in:
Carlos Ruiz 2018-03-16 09:25:36 -03:00
parent 490adbe45d
commit 0962dd0783
4 changed files with 15 additions and 3 deletions

View File

@ -29,6 +29,9 @@
<password>@ADEMPIERE_DB_PASSWORD@</password> <password>@ADEMPIERE_DB_PASSWORD@</password>
</group> </group>
<management-center enabled="false">http://localhost:8080/mancenter</management-center> <management-center enabled="false">http://localhost:8080/mancenter</management-center>
<properties>
<property name="hazelcast.discovery.enabled">false</property>
</properties>
<network> <network>
<port auto-increment="true" port-count="100">5701</port> <port auto-increment="true" port-count="100">5701</port>
<outbound-ports> <outbound-ports>

View File

@ -29,6 +29,9 @@
<password>dev-pass</password> <password>dev-pass</password>
</group> </group>
<management-center enabled="false">http://localhost:8080/mancenter</management-center> <management-center enabled="false">http://localhost:8080/mancenter</management-center>
<properties>
<property name="hazelcast.discovery.enabled">false</property>
</properties>
<network> <network>
<port auto-increment="true" port-count="100">5701</port> <port auto-increment="true" port-count="100">5701</port>
<outbound-ports> <outbound-ports>

View File

@ -20,6 +20,7 @@ Import-Package: javax.crypto,
org.adempiere.base, org.adempiere.base,
org.compiere, org.compiere,
org.compiere.model, org.compiere.model,
org.compiere.util,
org.idempiere.distributed, org.idempiere.distributed,
org.osgi.framework;version="1.3.0", org.osgi.framework;version="1.3.0",
org.slf4j;version="1.6.1", org.slf4j;version="1.6.1",

View File

@ -24,6 +24,7 @@ import java.util.Enumeration;
import org.compiere.Adempiere; import org.compiere.Adempiere;
import org.compiere.model.ServerStateChangeEvent; import org.compiere.model.ServerStateChangeEvent;
import org.compiere.model.ServerStateChangeListener; import org.compiere.model.ServerStateChangeListener;
import org.compiere.util.CLogger;
import org.eclipse.osgi.framework.console.CommandProvider; import org.eclipse.osgi.framework.console.CommandProvider;
import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
@ -43,6 +44,7 @@ import com.hazelcast.core.HazelcastInstance;
public class Activator implements BundleActivator { public class Activator implements BundleActivator {
private static BundleContext context; private static BundleContext context;
protected final static CLogger logger = CLogger.getCLogger(Activator.class.getName());
static BundleContext getContext() { static BundleContext getContext() {
return context; return context;
@ -120,10 +122,11 @@ public class Activator implements BundleActivator {
try { try {
Config config = new FileSystemXmlConfig(file); Config config = new FileSystemXmlConfig(file);
config.setClassLoader(Activator.class.getClassLoader()); config.setClassLoader(Activator.class.getClassLoader());
logger.warning("Starting hazelcast with configuration from file " + file.getName());
hazelcastInstance = Hazelcast.newHazelcastInstance(config); hazelcastInstance = Hazelcast.newHazelcastInstance(config);
MapConfig mc = config.getMapConfig("default"); MapConfig mc = config.getMapConfig("default");
if (mc != null) { 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; return;
} catch (FileNotFoundException e) {} } catch (FileNotFoundException e) {}
@ -135,10 +138,11 @@ public class Activator implements BundleActivator {
try { try {
Config config = new UrlXmlConfig(url); Config config = new UrlXmlConfig(url);
config.setClassLoader(Activator.class.getClassLoader()); config.setClassLoader(Activator.class.getClassLoader());
logger.warning("Starting hazelcast with configuration from URL " + url.toString());
hazelcastInstance = Hazelcast.newHazelcastInstance(config); hazelcastInstance = Hazelcast.newHazelcastInstance(config);
MapConfig mc = config.getMapConfig("default"); MapConfig mc = config.getMapConfig("default");
if (mc != null) { 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; return;
} catch (IOException e) {} } catch (IOException e) {}
@ -147,9 +151,10 @@ public class Activator implements BundleActivator {
Config config = new Config(); Config config = new Config();
config.setClassLoader(Activator.class.getClassLoader()); config.setClassLoader(Activator.class.getClassLoader());
hazelcastInstance = Hazelcast.newHazelcastInstance(config); hazelcastInstance = Hazelcast.newHazelcastInstance(config);
logger.warning("Starting hazelcast with default configuration");
MapConfig mc = config.getMapConfig("default"); MapConfig mc = config.getMapConfig("default");
if (mc != null) { 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());
} }
} }