Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-24827 BackPort HBASE-11554 Remove Reusable poolmap Rpc client type. #2208

Merged
merged 1 commit into from
Aug 6, 2020
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -228,7 +228,7 @@ protected interface Pool<R> {
}

public enum PoolType {
Reusable, ThreadLocal, RoundRobin;
ThreadLocal, RoundRobin;

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

protected Pool<V> createPool() {
switch (poolType) {
case Reusable:
return new ReusablePool<>(poolMaxSize);
case RoundRobin:
return new RoundRobinPool<>(poolMaxSize);
case ThreadLocal:
@@ -280,51 +278,6 @@ protected Pool<V> createPool() {
return null;
}

/**
* The <code>ReusablePool</code> represents a {@link PoolMap.Pool} that builds
* on the {@link java.util.LinkedList} class. It essentially allows resources to be
* checked out, at which point it is removed from this pool. When the resource
* is no longer required, it should be returned to the pool in order to be
* reused.
*
* <p>
* If {@link #maxSize} is set to {@link Integer#MAX_VALUE}, then the size of
* the pool is unbounded. Otherwise, it caps the number of consumers that can
* check out a resource from this pool to the (non-zero positive) value
* specified in {@link #maxSize}.
* </p>
*
* @param <R>
* the type of the resource
*/
@SuppressWarnings("serial")
public static class ReusablePool<R> extends ConcurrentLinkedQueue<R> implements Pool<R> {
private int maxSize;

public ReusablePool(int maxSize) {
this.maxSize = maxSize;

}

@Override
public R get() {
return poll();
}

@Override
public R put(R resource) {
if (super.size() < maxSize) {
add(resource);
}
return null;
}

@Override
public Collection<R> values() {
return this;
}
}

/**
* The <code>RoundRobinPool</code> represents a {@link PoolMap.Pool}, which
* stores its resources in an {@link ArrayList}. It load-balances access to

This file was deleted.