Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Minor cleanup --- changed some todos to documentation and comments.
  • Loading branch information
jayjwylie committed Oct 9, 2012
1 parent e1fc74c commit a28bcd9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/java/voldemort/utils/pool/KeyedResourcePool.java
Expand Up @@ -186,11 +186,11 @@ protected Pool<V> getResourcePoolForExistingKey(K key) {
}

/*
* A safe wrapper to destroy the given resource that catches any user
* exceptions.
* A "safe" wrapper to destroy the given resource that catches any user
* exceptions. This wrapper is safe in that it does not throw any
* exceptions. However, this wrapper updates the size of the resource pool
* and so should be called no more than once for any resource.
*/
// TODO: If this method is called multiple times on the same resource, the
// resourcePool size gets decremented too many times and badness ensues.
protected void destroyResource(K key, Pool<V> resourcePool, V resource) {
if(resource != null) {
try {
Expand All @@ -199,7 +199,8 @@ protected void destroyResource(K key, Pool<V> resourcePool, V resource) {
logger.error("Exception while destroying invalid resource: ", e);
} finally {
// Assumes destroyed resource was in fact checked out of the
// pool.
// pool. Also assumes that this method will be called no more
// than once for any given checked out resource.
resourcePool.size.decrementAndGet();
}
}
Expand Down
Expand Up @@ -375,8 +375,8 @@ public void testRORebalanceWithReplication() throws Exception {
// start servers 0 , 1 only
List<Integer> serverList = Arrays.asList(0, 1);

// TODO: Why does increasing the number of admin threads make the tests
// run? Without this increase, the RejectedExecutionHandler in
// If this test fails, consider increasing the number of admin threads.
// In particular, if this test fails by RejectedExecutionHandler in
// SocketServer.java fires with an error message like the following:
// "[18:46:32,994 voldemort.server.socket.SocketServer[admin-server]]
// ERROR Too many open connections, 20 of 20 threads in use, denying
Expand Down

0 comments on commit a28bcd9

Please sign in to comment.