Skip to content

Commit

Permalink
HBASE-26088 Fix thread leaks in conn#getBufferedMutator(tableName) me…
Browse files Browse the repository at this point in the history
…thod call (#3506)

Co-authored-by: Rushabh Shah <[email protected]>
Signed-off-by: zhangduo <[email protected]>
Signed-off-by: Anoop <[email protected]>
Signed-off-by: stack <[email protected]>
Signed-off-by: Reid Chan <[email protected]>
  • Loading branch information
shahrs87 and Rushabh Shah authored Jul 21, 2021
1 parent cabf0dc commit 253b83d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,15 @@ default Table getTable(TableName tableName, ExecutorService pool) throws IOExcep
/**
* <p>
* Retrieve a {@link BufferedMutator} for performing client-side buffering of writes. The
* {@link BufferedMutator} returned by this method is thread-safe. This BufferedMutator will
* use the Connection's ExecutorService. This object can be used for long lived operations.
* {@link BufferedMutator} returned by this method is thread-safe.
* 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>
* The caller is responsible for calling {@link BufferedMutator#close()} on
* the returned {@link BufferedMutator} instance.
* </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
*
Expand All @@ -129,7 +128,10 @@ default Table getTable(TableName tableName, ExecutorService pool) throws IOExcep
/**
* 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
* 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.
*
* @param params details on how to instantiate the {@code BufferedMutator}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,6 @@ public BufferedMutator getBufferedMutator(BufferedMutatorParams params) {
if (params.getTableName() == null) {
throw new IllegalArgumentException("TableName cannot be null.");
}
if (params.getPool() == null) {
params.pool(HTable.getDefaultExecutor(getConfiguration()));
}
if (params.getWriteBufferSize() == BufferedMutatorParams.UNSET) {
params.writeBufferSize(connectionConfig.getWriteBufferSize());
}
Expand Down

0 comments on commit 253b83d

Please sign in to comment.