Skip to content
Snippets Groups Projects
Commit 8674d2fd authored by Sören Henning's avatar Sören Henning
Browse files

some comment adjustments

parent 2cfa225d
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,8 @@ public class CassandraService { ...@@ -19,6 +19,8 @@ public class CassandraService {
private Session session; private Session session;
// BETTER A logger should be used to replace the System.out.println()
@Autowired @Autowired
public CassandraService(@Value("${cassandra.address}") final String host, @Value("${cassandra.port}") final int port, public CassandraService(@Value("${cassandra.address}") final String host, @Value("${cassandra.port}") final int port,
@Value("${cassandra.keyspace}") final String keyspace, @Value("${cassandra.timeout}") final int timeoutInMillis) { @Value("${cassandra.keyspace}") final String keyspace, @Value("${cassandra.timeout}") final int timeoutInMillis) {
...@@ -32,8 +34,8 @@ public class CassandraService { ...@@ -32,8 +34,8 @@ public class CassandraService {
private void createSession(final String host, final int port, final String keyspace, final int timeoutInMillis) { private void createSession(final String host, final int port, final String keyspace, final int timeoutInMillis) {
final Instant start = Instant.now(); final Instant start = Instant.now();
System.out.println("Use host: " + host); // TODO // System.out.println("Use host: " + host);
System.out.println("Use port: " + port); // TODO // System.out.println("Use port: " + port);
Cluster cluster = Cluster.builder().addContactPoint(host).withPort(port).build(); Cluster cluster = Cluster.builder().addContactPoint(host).withPort(port).build();
while (true) { while (true) {
...@@ -41,8 +43,8 @@ public class CassandraService { ...@@ -41,8 +43,8 @@ public class CassandraService {
this.session = cluster.connect(keyspace); this.session = cluster.connect(keyspace);
break; break;
} catch (NoHostAvailableException exception) { } catch (NoHostAvailableException exception) {
// Host not unavailable // Host not available
System.out.println("Waiting for host..."); // TODO // System.out.println("Waiting for host...");
if (Duration.between(start, Instant.now()).toMillis() < timeoutInMillis) { if (Duration.between(start, Instant.now()).toMillis() < timeoutInMillis) {
cluster.close(); cluster.close();
cluster = Cluster.builder().addContactPoint(host).withPort(port).build(); cluster = Cluster.builder().addContactPoint(host).withPort(port).build();
...@@ -56,7 +58,7 @@ public class CassandraService { ...@@ -56,7 +58,7 @@ public class CassandraService {
} }
} catch (InvalidQueryException exception) { } catch (InvalidQueryException exception) {
// Keyspace does not exist // Keyspace does not exist
System.out.println("Create Keyspace..."); // TODO // System.out.println("Create Keyspace...");
createKeyspaceIfNotExists(cluster, keyspace); createKeyspaceIfNotExists(cluster, keyspace);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment