THRIFT-2649 TAsyncClientManager leaks the selector

Client: Java
Patch: Roelof Naude
Signed-off-by: Roger Meier <roger@apache.org>
diff --git a/lib/java/src/org/apache/thrift/async/TAsyncClientManager.java b/lib/java/src/org/apache/thrift/async/TAsyncClientManager.java
index 6fcf4b4..c07ccd5 100644
--- a/lib/java/src/org/apache/thrift/async/TAsyncClientManager.java
+++ b/lib/java/src/org/apache/thrift/async/TAsyncClientManager.java
@@ -117,6 +117,12 @@
           LOGGER.error("Ignoring uncaught exception in SelectThread", exception);
         }
       }
+
+      try {
+        selector.close();
+      } catch (IOException ex) {
+        LOGGER.warn("Could not close selector. This may result in leaked resources!", ex);
+      }
     }
 
     // Transition methods for ready keys