Skip to content

Commit 0a7398f

Browse files
committed
Fixed connection leaks
1 parent 70a0b12 commit 0a7398f

File tree

1 file changed

+8
-2
lines changed
  • src/main/java/com/atomgraph/linkeddatahub/resource/admin

1 file changed

+8
-2
lines changed

src/main/java/com/atomgraph/linkeddatahub/resource/admin/Clear.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,18 @@ public Response post(@FormParam("uri") String ontologyURI, @HeaderParam("Referer
9191
{
9292
URI ontologyDocURI = UriBuilder.fromUri(ontologyURI).fragment(null).build(); // skip fragment from the ontology URI to get its graph URI
9393
if (log.isDebugEnabled()) log.debug("Purge ontology document with URI '{}' from frontend proxy cache", ontologyDocURI);
94-
purge(getApplication().getFrontendProxy(), ontologyDocURI.toString());
94+
try (Response response = purge(getApplication().getFrontendProxy(), ontologyDocURI.toString()))
95+
{
96+
// Response automatically closed by try-with-resources
97+
}
9598
}
9699
if (getApplication().getService().getBackendProxy() != null)
97100
{
98101
if (log.isDebugEnabled()) log.debug("Ban ontology with URI '{}' from backend proxy cache", ontologyURI);
99-
ban(getApplication().getService().getBackendProxy(), ontologyURI);
102+
try (Response response = ban(getApplication().getService().getBackendProxy(), ontologyURI))
103+
{
104+
// Response automatically closed by try-with-resources
105+
}
100106
}
101107

102108
// !!! we need to reload the ontology model before returning a response, to make sure the next request already gets the new version !!!

0 commit comments

Comments
 (0)