HBASE-6637 Move DaemonThreadFactory into Threads and Threads to hbase-common (Jesse Yates)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1390034 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fa4016dc20
commit
b6a36ec9ab
|
@ -48,7 +48,6 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.classification.InterfaceStability;
|
import org.apache.hadoop.classification.InterfaceStability;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.DaemonThreadFactory;
|
|
||||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
import org.apache.hadoop.hbase.HRegionInfo;
|
import org.apache.hadoop.hbase.HRegionInfo;
|
||||||
|
@ -78,6 +77,7 @@ import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.CompareType;
|
||||||
import org.apache.hadoop.hbase.util.Addressing;
|
import org.apache.hadoop.hbase.util.Addressing;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
import org.apache.hadoop.hbase.util.Pair;
|
import org.apache.hadoop.hbase.util.Pair;
|
||||||
|
import org.apache.hadoop.hbase.util.Threads;
|
||||||
|
|
||||||
import com.google.protobuf.ServiceException;
|
import com.google.protobuf.ServiceException;
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ public class HTable implements HTableInterface {
|
||||||
// we only create as many Runnables as there are region servers. It means
|
// we only create as many Runnables as there are region servers. It means
|
||||||
// it also scales when new region servers are added.
|
// it also scales when new region servers are added.
|
||||||
this.pool = new ThreadPoolExecutor(1, maxThreads, keepAliveTime, TimeUnit.SECONDS,
|
this.pool = new ThreadPoolExecutor(1, maxThreads, keepAliveTime, TimeUnit.SECONDS,
|
||||||
new SynchronousQueue<Runnable>(), new DaemonThreadFactory("hbase-table-pool"));
|
new SynchronousQueue<Runnable>(), Threads.newDaemonThreadFactory("hbase-table"));
|
||||||
((ThreadPoolExecutor) this.pool).allowCoreThreadTimeOut(true);
|
((ThreadPoolExecutor) this.pool).allowCoreThreadTimeOut(true);
|
||||||
|
|
||||||
this.finishSetup();
|
this.finishSetup();
|
||||||
|
|
|
@ -18,11 +18,21 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.replication.regionserver;
|
package org.apache.hadoop.hbase.replication.regionserver;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.SynchronousQueue;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.DaemonThreadFactory;
|
|
||||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
import org.apache.hadoop.hbase.KeyValue;
|
import org.apache.hadoop.hbase.KeyValue;
|
||||||
|
@ -38,17 +48,7 @@ import org.apache.hadoop.hbase.regionserver.wal.HLog;
|
||||||
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
|
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
|
||||||
import org.apache.hadoop.hbase.replication.regionserver.metrics.ReplicationSinkMetrics;
|
import org.apache.hadoop.hbase.replication.regionserver.metrics.ReplicationSinkMetrics;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
|
import org.apache.hadoop.hbase.util.Threads;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.SynchronousQueue;
|
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is responsible for replicating the edits coming
|
* This class is responsible for replicating the edits coming
|
||||||
|
@ -91,7 +91,7 @@ public class ReplicationSink {
|
||||||
this.sharedThreadPool = new ThreadPoolExecutor(1,
|
this.sharedThreadPool = new ThreadPoolExecutor(1,
|
||||||
conf.getInt("hbase.htable.threads.max", Integer.MAX_VALUE),
|
conf.getInt("hbase.htable.threads.max", Integer.MAX_VALUE),
|
||||||
conf.getLong("hbase.htable.threads.keepalivetime", 60), TimeUnit.SECONDS,
|
conf.getLong("hbase.htable.threads.keepalivetime", 60), TimeUnit.SECONDS,
|
||||||
new SynchronousQueue<Runnable>(), new DaemonThreadFactory("hbase-repl"));
|
new SynchronousQueue<Runnable>(), Threads.newDaemonThreadFactory("hbase-repl"));
|
||||||
((ThreadPoolExecutor) this.sharedThreadPool).allowCoreThreadTimeOut(true);
|
((ThreadPoolExecutor) this.sharedThreadPool).allowCoreThreadTimeOut(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,7 @@ import org.apache.hadoop.hbase.regionserver.HRegionServer;
|
||||||
import org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException;
|
import org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException;
|
||||||
import org.apache.hadoop.hbase.regionserver.Store;
|
import org.apache.hadoop.hbase.regionserver.Store;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
|
import org.apache.hadoop.hbase.util.Threads;
|
||||||
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
|
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
|
||||||
import org.apache.hadoop.io.DataInputBuffer;
|
import org.apache.hadoop.io.DataInputBuffer;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -3969,7 +3970,7 @@ public class TestFromClientSide {
|
||||||
ExecutorService pool = new ThreadPoolExecutor(1, Integer.MAX_VALUE,
|
ExecutorService pool = new ThreadPoolExecutor(1, Integer.MAX_VALUE,
|
||||||
60, TimeUnit.SECONDS,
|
60, TimeUnit.SECONDS,
|
||||||
new SynchronousQueue<Runnable>(),
|
new SynchronousQueue<Runnable>(),
|
||||||
new DaemonThreadFactory("test-from-client-pool"));
|
Threads.newDaemonThreadFactory("test-from-client"));
|
||||||
((ThreadPoolExecutor)pool).allowCoreThreadTimeOut(true);
|
((ThreadPoolExecutor)pool).allowCoreThreadTimeOut(true);
|
||||||
return new HTable(tableName, conn, pool);
|
return new HTable(tableName, conn, pool);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.*;
|
import org.apache.hadoop.hbase.*;
|
||||||
import org.apache.hadoop.hbase.regionserver.HRegionServer;
|
import org.apache.hadoop.hbase.regionserver.HRegionServer;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
|
import org.apache.hadoop.hbase.util.Threads;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
@ -287,7 +288,7 @@ public class TestHCM {
|
||||||
ThreadPoolExecutor pool = new ThreadPoolExecutor(1, 10,
|
ThreadPoolExecutor pool = new ThreadPoolExecutor(1, 10,
|
||||||
60, TimeUnit.SECONDS,
|
60, TimeUnit.SECONDS,
|
||||||
new SynchronousQueue<Runnable>(),
|
new SynchronousQueue<Runnable>(),
|
||||||
new DaemonThreadFactory("test-hcm-pool"));
|
Threads.newDaemonThreadFactory("test-hcm"));
|
||||||
|
|
||||||
HTable table = new HTable(TABLE_NAME1, conn, pool);
|
HTable table = new HTable(TABLE_NAME1, conn, pool);
|
||||||
table.close();
|
table.close();
|
||||||
|
|
Loading…
Reference in New Issue