Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
KiekPAD-Viz-Provider
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sören Henning
KiekPAD-Viz-Provider
Commits
8674d2fd
Commit
8674d2fd
authored
8 years ago
by
Sören Henning
Browse files
Options
Downloads
Patches
Plain Diff
some comment adjustments
parent
2cfa225d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/kiekpad/vizprovider/service/CassandraService.java
+7
-5
7 additions, 5 deletions
...in/java/kiekpad/vizprovider/service/CassandraService.java
with
7 additions
and
5 deletions
src/main/java/kiekpad/vizprovider/service/CassandraService.java
+
7
−
5
View file @
8674d2fd
...
@@ -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
un
available
// 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
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment