本文整理汇总了Java中org.apache.hadoop.hbase.util.HasThread类的典型用法代码示例。如果您正苦于以下问题:Java HasThread类的具体用法?Java HasThread怎么用?Java HasThread使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HasThread类属于org.apache.hadoop.hbase.util包,在下文中一共展示了HasThread类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startAssignmentThread
import org.apache.hadoop.hbase.util.HasThread; //导入依赖的package包/类
private void startAssignmentThread() {
// Get Server Thread name. Sometimes the Server is mocked so may not implement HasThread.
// For example, in tests.
String name = master instanceof HasThread? ((HasThread)master).getName():
master.getServerName().toShortString();
assignThread = new Thread(name) {
@Override
public void run() {
while (isRunning()) {
processAssignQueue();
}
pendingAssignQueue.clear();
}
};
assignThread.setDaemon(true);
assignThread.start();
}
示例2: SplitLogManager
import org.apache.hadoop.hbase.util.HasThread; //导入依赖的package包/类
/**
* Its OK to construct this object even when region-servers are not online. It does lookup the
* orphan tasks in coordination engine but it doesn't block waiting for them to be done.
* @param master the master services
* @param conf the HBase configuration
* @throws IOException
*/
public SplitLogManager(MasterServices master, Configuration conf)
throws IOException {
this.server = master;
this.conf = conf;
// Get Server Thread name. Sometimes the Server is mocked so may not implement HasThread.
// For example, in tests.
String name = master instanceof HasThread? ((HasThread)master).getName():
master.getServerName().toShortString();
this.choreService =
new ChoreService(name + ".splitLogManager.");
if (server.getCoordinatedStateManager() != null) {
SplitLogManagerCoordination coordination = getSplitLogManagerCoordination();
Set<String> failedDeletions = Collections.synchronizedSet(new HashSet<String>());
SplitLogManagerDetails details = new SplitLogManagerDetails(tasks, master, failedDeletions);
coordination.setDetails(details);
coordination.init();
}
this.unassignedTimeout =
conf.getInt("hbase.splitlog.manager.unassigned.timeout", DEFAULT_UNASSIGNED_TIMEOUT);
this.timeoutMonitor =
new TimeoutMonitor(conf.getInt("hbase.splitlog.manager.timeoutmonitor.period", 1000),
master);
choreService.scheduleChore(timeoutMonitor);
}
示例3: setDaemonThreadRunning
import org.apache.hadoop.hbase.util.HasThread; //导入依赖的package包/类
public static HasThread setDaemonThreadRunning(final HasThread t,
final String name, final UncaughtExceptionHandler handler) {
t.setName(name);
if (handler != null) {
t.setUncaughtExceptionHandler(handler);
}
t.setDaemon(true);
t.start();
return t;
}