Skip to content

Commit 9c73464

Browse files
committed
[HBASE-27991] fixing ClassCastException in multithread client run
1 parent 7cfa47d commit 9c73464

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/MultiThreadedClientExample.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
import java.util.concurrent.Callable;
2424
import java.util.concurrent.ExecutorService;
2525
import java.util.concurrent.Executors;
26-
import java.util.concurrent.ForkJoinPool;
2726
import java.util.concurrent.Future;
27+
import java.util.concurrent.LinkedBlockingQueue;
2828
import java.util.concurrent.ThreadFactory;
2929
import java.util.concurrent.ThreadLocalRandom;
30+
import java.util.concurrent.ThreadPoolExecutor;
3031
import java.util.concurrent.TimeUnit;
3132
import org.apache.hadoop.conf.Configured;
3233
import org.apache.hadoop.hbase.Cell;
@@ -129,7 +130,8 @@ public int run(String[] args) throws Exception {
129130
//
130131
// We don't want to mix hbase and business logic.
131132
//
132-
ExecutorService service = new ForkJoinPool(threads * 2);
133+
ThreadPoolExecutor service = new ThreadPoolExecutor(threads * 2, threads * 2, 60L,
134+
TimeUnit.SECONDS, new LinkedBlockingQueue<>());
133135

134136
// Create two different connections showing how it's possible to
135137
// separate different types of requests onto different connections

0 commit comments

Comments
 (0)