diff options
author | Bharath Balasubramanian <bharathb@research.att.com> | 2019-02-01 19:53:34 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-02-01 19:53:34 +0000 |
commit | 2357dbf628ddf889b7a1640ccb11a424f6a7dacd (patch) | |
tree | eecb17b034b2e55bfcb08c8581f99216e6ea8360 /jar | |
parent | 32bcfc2f85583d35c2abea242d7107fd72a98749 (diff) | |
parent | c752be120a8f8708471246497e0619a7d468debe (diff) |
Merge "Update Jar."
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)); } |