diff options
Diffstat (limited to 'jar')
-rwxr-xr-x | jar/pom.xml | 2 | ||||
-rw-r--r-- | jar/src/main/java/org/onap/music/datastore/MusicDataStore.java | 14 | ||||
-rwxr-xr-x | jar/src/main/java/org/onap/music/main/MusicUtil.java | 19 |
3 files changed, 29 insertions, 6 deletions
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 @@ <groupId>org.onap.music</groupId> <artifactId>MUSIC</artifactId> <packaging>jar</packaging> - <version>2.5.7</version> + <version>2.5.8</version> <description> This is the MUSIC REST interface, packaged as a war file. </description> 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"); @@ -342,6 +343,21 @@ public class MusicUtil { } /** + * + * @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)); } |