Skip to content

Commit 8646ac1

Browse files
jmhsiehniuyulin
authored andcommitted
HBASE-24827 BackPort HBASE-11554 Remove Reusable poolmap Rpc client type. (#2208)
Co-authored-by: niuyulin <[email protected]> Signed-off-by: stack <[email protected]>
1 parent b9c415a commit 8646ac1

File tree

2 files changed

+1
-138
lines changed

2 files changed

+1
-138
lines changed

hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ protected interface Pool<R> {
228228
}
229229

230230
public enum PoolType {
231-
Reusable, ThreadLocal, RoundRobin;
231+
ThreadLocal, RoundRobin;
232232

233233
public static PoolType valueOf(String poolTypeName,
234234
PoolType defaultPoolType, PoolType... allowedPoolTypes) {
@@ -270,8 +270,6 @@ public static PoolType fuzzyMatch(String name) {
270270

271271
protected Pool<V> createPool() {
272272
switch (poolType) {
273-
case Reusable:
274-
return new ReusablePool<>(poolMaxSize);
275273
case RoundRobin:
276274
return new RoundRobinPool<>(poolMaxSize);
277275
case ThreadLocal:
@@ -280,51 +278,6 @@ protected Pool<V> createPool() {
280278
return null;
281279
}
282280

283-
/**
284-
* The <code>ReusablePool</code> represents a {@link PoolMap.Pool} that builds
285-
* on the {@link java.util.LinkedList} class. It essentially allows resources to be
286-
* checked out, at which point it is removed from this pool. When the resource
287-
* is no longer required, it should be returned to the pool in order to be
288-
* reused.
289-
*
290-
* <p>
291-
* If {@link #maxSize} is set to {@link Integer#MAX_VALUE}, then the size of
292-
* the pool is unbounded. Otherwise, it caps the number of consumers that can
293-
* check out a resource from this pool to the (non-zero positive) value
294-
* specified in {@link #maxSize}.
295-
* </p>
296-
*
297-
* @param <R>
298-
* the type of the resource
299-
*/
300-
@SuppressWarnings("serial")
301-
public static class ReusablePool<R> extends ConcurrentLinkedQueue<R> implements Pool<R> {
302-
private int maxSize;
303-
304-
public ReusablePool(int maxSize) {
305-
this.maxSize = maxSize;
306-
307-
}
308-
309-
@Override
310-
public R get() {
311-
return poll();
312-
}
313-
314-
@Override
315-
public R put(R resource) {
316-
if (super.size() < maxSize) {
317-
add(resource);
318-
}
319-
return null;
320-
}
321-
322-
@Override
323-
public Collection<R> values() {
324-
return this;
325-
}
326-
}
327-
328281
/**
329282
* The <code>RoundRobinPool</code> represents a {@link PoolMap.Pool}, which
330283
* stores its resources in an {@link ArrayList}. It load-balances access to

hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestReusablePoolMap.java

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)