HBASE-26088 Fix thread leaks in conn#getBufferedMutator(tableName) method call (#3506)
Co-authored-by: Rushabh Shah <rushabh.shah@rushabh-ltmflld.internal.salesforce.com> Signed-off-by: zhangduo <zhangduo@apache.org> Signed-off-by: Anoop <anoopsamjohn@apache.org> Signed-off-by: stack <stack@duboce.net> Signed-off-by: Reid Chan <reidchan@apache.org>
This commit is contained in:
parent
cabf0dc51d
commit
253b83db57
@ -109,16 +109,15 @@ public interface Connection extends Abortable, Closeable {
|
|||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Retrieve a {@link BufferedMutator} for performing client-side buffering of writes. The
|
* Retrieve a {@link BufferedMutator} for performing client-side buffering of writes. The
|
||||||
* {@link BufferedMutator} returned by this method is thread-safe. This BufferedMutator will
|
* {@link BufferedMutator} returned by this method is thread-safe.
|
||||||
* use the Connection's ExecutorService. This object can be used for long lived operations.
|
* This accessor will create a new ThreadPoolExecutor and will be shutdown once we close the
|
||||||
|
* BufferedMutator. This object can be used for long lived operations.
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* The caller is responsible for calling {@link BufferedMutator#close()} on
|
* The caller is responsible for calling {@link BufferedMutator#close()} on
|
||||||
* the returned {@link BufferedMutator} instance.
|
* the returned {@link BufferedMutator} instance.
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* This accessor will use the connection's ExecutorService and will throw an
|
|
||||||
* exception in the main thread when an asynchronous exception occurs.
|
|
||||||
*
|
*
|
||||||
* @param tableName the name of the table
|
* @param tableName the name of the table
|
||||||
*
|
*
|
||||||
@ -129,7 +128,10 @@ public interface Connection extends Abortable, Closeable {
|
|||||||
/**
|
/**
|
||||||
* Retrieve a {@link BufferedMutator} for performing client-side buffering of writes. The
|
* Retrieve a {@link BufferedMutator} for performing client-side buffering of writes. The
|
||||||
* {@link BufferedMutator} returned by this method is thread-safe. This object can be used for
|
* {@link BufferedMutator} returned by this method is thread-safe. This object can be used for
|
||||||
* long lived table operations. The caller is responsible for calling
|
* long lived table operations. If user passes ThreadPool in BufferedMutatorParams then we will
|
||||||
|
* use that otherwise we will create for the user. For user specified ThreadPool, it is the user's
|
||||||
|
* responsibility to shutdown. For ThreadPool created by us, we will shutdown when user calls
|
||||||
|
* {@link BufferedMutator#close()}. The caller is responsible for calling
|
||||||
* {@link BufferedMutator#close()} on the returned {@link BufferedMutator} instance.
|
* {@link BufferedMutator#close()} on the returned {@link BufferedMutator} instance.
|
||||||
*
|
*
|
||||||
* @param params details on how to instantiate the {@code BufferedMutator}.
|
* @param params details on how to instantiate the {@code BufferedMutator}.
|
||||||
|
@ -414,9 +414,6 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
|
|||||||
if (params.getTableName() == null) {
|
if (params.getTableName() == null) {
|
||||||
throw new IllegalArgumentException("TableName cannot be null.");
|
throw new IllegalArgumentException("TableName cannot be null.");
|
||||||
}
|
}
|
||||||
if (params.getPool() == null) {
|
|
||||||
params.pool(HTable.getDefaultExecutor(getConfiguration()));
|
|
||||||
}
|
|
||||||
if (params.getWriteBufferSize() == BufferedMutatorParams.UNSET) {
|
if (params.getWriteBufferSize() == BufferedMutatorParams.UNSET) {
|
||||||
params.writeBufferSize(connectionConfig.getWriteBufferSize());
|
params.writeBufferSize(connectionConfig.getWriteBufferSize());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user