From c752be120a8f8708471246497e0619a7d468debe Mon Sep 17 00:00:00 2001 From: "Nelson,Thomas(tn1381)(arthurdent3)" Date: Thu, 31 Jan 2019 18:11:35 -0500 Subject: Update Jar. Change-Id: Ib78033ce66873e2180a6248a97339c0b54a22500 Issue-ID: MUSIC-303 Signed-off-by: Nelson,Thomas(tn1381)(arthurdent3) --- jar/pom.xml | 2 +- .../java/org/onap/music/datastore/MusicDataStore.java | 14 +++++++++----- jar/src/main/java/org/onap/music/main/MusicUtil.java | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) (limited to 'jar') diff --git a/jar/pom.xml b/jar/pom.xml index ffa49336..6aef40eb 100755 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -25,7 +25,7 @@ org.onap.music MUSIC jar - 2.5.7 + 2.5.8 This is the MUSIC REST interface, packaged as a war file. diff --git a/jar/src/main/java/org/onap/music/datastore/MusicDataStore.java b/jar/src/main/java/org/onap/music/datastore/MusicDataStore.java index 959ea83d..2fbca444 100644 --- a/jar/src/main/java/org/onap/music/datastore/MusicDataStore.java +++ b/jar/src/main/java/org/onap/music/datastore/MusicDataStore.java @@ -55,6 +55,7 @@ import com.datastax.driver.core.exceptions.NoHostAvailableException; import com.datastax.driver.core.policies.RoundRobinPolicy; import com.datastax.driver.core.HostDistance; import com.datastax.driver.core.PoolingOptions; +import org.onap.music.main.MusicUtil; /** @@ -167,17 +168,18 @@ public class MusicDataStore { .setConnectionsPerHost(HostDistance.REMOTE, 2, 4); while (it.hasNext()) { try { - if(MusicUtil.getCassName() != null && MusicUtil.getCassPwd() != null) { + if(MusicUtil.getCassName() != null && MusicUtil.getCassPwd() != null) { logger.info(EELFLoggerDelegate.applicationLogger, "Building with credentials "+MusicUtil.getCassName()+" & "+MusicUtil.getCassPwd()); - cluster = Cluster.builder().withPort(9042) + cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort()) .withCredentials(MusicUtil.getCassName(), MusicUtil.getCassPwd()) //.withLoadBalancingPolicy(new RoundRobinPolicy()) + .withoutJMXReporting() .withPoolingOptions(poolingOptions) .addContactPoints(addresses).build(); } else - cluster = Cluster.builder().withPort(9042) + cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort()) //.withLoadBalancingPolicy(new RoundRobinPolicy()) .addContactPoints(addresses).build(); @@ -216,15 +218,17 @@ public class MusicDataStore { if(MusicUtil.getCassName() != null && MusicUtil.getCassPwd() != null) { logger.info(EELFLoggerDelegate.applicationLogger, "Building with credentials "+MusicUtil.getCassName()+" & "+MusicUtil.getCassPwd()); - cluster = Cluster.builder().withPort(9042) + cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort()) .withCredentials(MusicUtil.getCassName(), MusicUtil.getCassPwd()) //.withLoadBalancingPolicy(new RoundRobinPolicy()) + .withoutJMXReporting() .withPoolingOptions(poolingOptions) .addContactPoints(addresses).build(); } else { - cluster = Cluster.builder().withPort(9042) + cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort()) //.withLoadBalancingPolicy(new RoundRobinPolicy()) + .withoutJMXReporting() .withPoolingOptions(poolingOptions) .addContactPoints(addresses).build(); } diff --git a/jar/src/main/java/org/onap/music/main/MusicUtil.java b/jar/src/main/java/org/onap/music/main/MusicUtil.java index 0e844215..c36da9d7 100755 --- a/jar/src/main/java/org/onap/music/main/MusicUtil.java +++ b/jar/src/main/java/org/onap/music/main/MusicUtil.java @@ -84,6 +84,7 @@ public class MusicUtil { private static String cassName = "cassandra"; private static String cassPwd = "cassandra"; private static String aafEndpointUrl = null; + private static int cassandraPort = 9042; private MusicUtil() { throw new IllegalStateException("Utility Class"); @@ -341,6 +342,21 @@ public class MusicUtil { MusicUtil.defaultMusicIp = defaultMusicIp; } + /** + * + * @return cassandra port + */ + public static int getCassandraPort() { + return cassandraPort; + } + + /** + * set cassandra port + * @param cassandraPort + */ + public static void setCassandraPort(int cassandraPort) { + MusicUtil.cassandraPort = cassandraPort; + } /** * * @return @@ -567,6 +583,9 @@ public class MusicUtil { String zkHosts = prop.getProperty("zookeeper.host"); MusicUtil.setMyZkHost(zkHosts); MusicUtil.setCassName(prop.getProperty("cassandra.user")); + String cassPort = prop.getProperty("cassandra.port"); + if(cassPort != null) + MusicUtil.setCassandraPort(Integer.parseInt(cassPort)); } -- cgit 1.2.3-korg