Skip to content

Loading…

[AS7-4056] fixing threads leak #6

Closed
wants to merge 1 commit into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 6, 2012
  1. @ropalka

    [AS7-4056] fixing threads leak

    ropalka committed
View
11 src/main/java/org/jboss/naming/remote/client/cache/ContextCache.java
@@ -112,6 +112,17 @@ public synchronized void release(final Object connectionHash, final boolean asyn
} finally {
cache.remove(connectionHash);
+ // close real connections finally
+ ConnectionWrapper conWrapper = (ConnectionWrapper) cacheEntry.connection;
+ if (async) {
+ conWrapper.delegate.closeAsync();
+ } else {
+ try {
+ conWrapper.delegate.close();
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to close connection", e);
+ }
+ }
}
}
}
View
11 src/main/java/org/jboss/naming/remote/client/cache/EndpointCache.java
@@ -71,6 +71,17 @@ public synchronized void release(final CacheKey endpointHash, final boolean asyn
} finally {
cache.remove(endpointHash);
+ // close real endpoints finally
+ EndpointWrapper epWrapper = (EndpointWrapper) cacheEntry.endpoint;
+ if (async) {
+ epWrapper.endpoint.closeAsync();
+ } else {
+ try {
+ epWrapper.endpoint.close();
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to close endpoint", e);
+ }
+ }
}
}
}
Something went wrong with that request. Please try again.