Author: tedyu
Date: Sat Aug 13 02:42:02 2011
New Revision: 1157310

URL: http://svn.apache.org/viewvc?rev=1157310&view=rev
Log:
HBASE-4150 update to javadoc (Karthick Sankarachary)

Modified:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
URL: 
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java?rev=1157310&r1=1157309&r2=1157310&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java 
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java Sat 
Aug 13 02:42:02 2011
@@ -760,12 +760,19 @@ public class HBaseClient {
   }
 
   /**
-   * Return the pool type specified in the configuration, if it roughly equals 
either
-   * the name of {@link PoolType#RoundRobin} or {@link PoolType#ThreadLocal}, 
otherwise
-   * default to the former type.
+   * Return the pool type specified in the configuration, which must be set to
+   * either {@link PoolType#RoundRobin} or {@link PoolType#ThreadLocal},
+   * otherwise default to the former.
+   *
+   * For applications with many user threads, use a small round-robin pool. For
+   * applications with few user threads, you may want to try using a
+   * thread-local pool. In any case, the number of {@link HBaseClient} 
instances
+   * should not exceed the operating system's hard limit on the number of
+   * connections.
    *
    * @param config configuration
-   * @return either a {@link PoolType#RoundRobin} or {@link 
PoolType#ThreadLocal}
+   * @return either a {@link PoolType#RoundRobin} or
+   *         {@link PoolType#ThreadLocal}
    */
   private static PoolType getPoolType(Configuration config) {
     return PoolType.valueOf(config.get(HConstants.HBASE_CLIENT_IPC_POOL_TYPE),
@@ -773,8 +780,8 @@ public class HBaseClient {
   }
 
   /**
-   * Return the pool size specified in the configuration, otherwise the 
maximum allowable 
-   * size (which for all intents and purposes represents an unbounded pool).
+   * Return the pool size specified in the configuration, which is applicable 
only if
+   * the pool type is {@link PoolType#RoundRobin}.
    *
    * @param config
    * @return the maximum pool size

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java
URL: 
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java?rev=1157310&r1=1157309&r2=1157310&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java 
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java Sat Aug 
13 02:42:02 2011
@@ -57,6 +57,10 @@ public class PoolMap<K, V> implements Ma
 
   private Map<K, Pool<V>> pools = new ConcurrentHashMap<K, Pool<V>>();
 
+  public PoolMap(PoolType poolType) {
+    this.poolType = poolType;
+  }
+
   public PoolMap(PoolType poolType, int poolMaxSize) {
     this.poolType = poolType;
     this.poolMaxSize = poolMaxSize;
@@ -262,7 +266,7 @@ public class PoolMap<K, V> implements Ma
     case RoundRobin:
       return new RoundRobinPool<V>(poolMaxSize);
     case ThreadLocal:
-      return new ThreadLocalPool<V>(poolMaxSize);
+      return new ThreadLocalPool<V>();
     }
     return null;
   }
@@ -368,24 +372,17 @@ public class PoolMap<K, V> implements Ma
    * to the thread from which it is accessed.
    *
    * <p>
-   * If {@link #maxSize} is set to {@link Integer#MAX_VALUE}, then the size of
-   * the pool is bounded only by the number of threads that add resources to
-   * this pool. Otherwise, it caps the number of threads that can set a value 
on
-   * this {@link ThreadLocal} instance to the (non-zero positive) value
-   * specified in {@link #maxSize}.
+   * Note that the size of the pool is essentially bounded by the number of 
threads
+   * that add resources to this pool.
    * </p>
    *
-   *
    * @param <R>
    *          the type of the resource
    */
   static class ThreadLocalPool<R> extends ThreadLocal<R> implements Pool<R> {
     private static final Map<ThreadLocalPool<?>, AtomicInteger> poolSizes = 
new HashMap<ThreadLocalPool<?>, AtomicInteger>();
 
-    private int maxSize;
-
-    public ThreadLocalPool(int maxSize) {
-      this.maxSize = maxSize;
+    public ThreadLocalPool() {
     }
 
     @Override


Reply via email to