Permalink
Browse files

Minor cleanup --- changed some todos to documentation and comments.

  • Loading branch information...
1 parent e1fc74c commit a28bcd989f0a7d2c32aa54b93889c32fede4b992 @jayjwylie jayjwylie committed Oct 4, 2012
@@ -186,11 +186,11 @@ protected boolean attemptGrow(K key, Pool<V> pool) throws Exception {
}
/*
- * 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 {
@@ -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();
}
}
@@ -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

0 comments on commit a28bcd9

Please sign in to comment.