Skip to content

Commit

Permalink
Fixed query to close when complete
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhks committed Jan 3, 2018
1 parent 0bad93b commit 8ced904
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>org.kairosdb</groupId>
<artifactId>kairos-healthcheck</artifactId>
<!--<version>1.0-SNAPSHOT</version>-->
<version>1.0</version>
<version>1.1</version>
<packaging>jar</packaging>

<name>kairos-kafka</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ public String getName()
@Override
protected HealthCheck.Result check() throws Exception
{
DatastoreQuery query = null;
try
{
DatastoreQuery query = m_datastore.createQuery(
new QueryMetric(System.currentTimeMillis() - (10 * 60 * 1000),
0, m_healthMetric));
query = m_datastore.createQuery(
new QueryMetric(System.currentTimeMillis() - (10 * 60 * 1000),
0, m_healthMetric));

query.execute();
return HealthCheck.Result.healthy();
Expand All @@ -50,5 +51,10 @@ protected HealthCheck.Result check() throws Exception
{
return HealthCheck.Result.unhealthy(e);
}
finally
{
if (query != null)
query.close();
}
}
}

0 comments on commit 8ced904

Please sign in to comment.