HBASE-3808 Implement Executor.toString for master handlers at least
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1132466 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
64f6fb52dc
commit
06eba7a579
|
@ -239,6 +239,8 @@ Release 0.91.0 - Unreleased
|
|||
HBASE-2556 Add convenience method to HBaseAdmin to get a collection of
|
||||
HRegionInfo objects for each table (Ming Ma)
|
||||
HBASE-3592 Guava snuck back in as a dependency via hbase-3777
|
||||
HBASE-3808 Implement Executor.toString for master handlers at least
|
||||
(Brock Noland)
|
||||
|
||||
TASKS
|
||||
HBASE-3559 Move report of split to master OFF the heartbeat channel
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
@ -188,7 +189,7 @@ public class ExecutorService {
|
|||
List<Runnable> wasRunning =
|
||||
entry.getValue().threadPoolExecutor.shutdownNow();
|
||||
if (!wasRunning.isEmpty()) {
|
||||
LOG.info(entry.getKey() + " had " + wasRunning + " on shutdown");
|
||||
LOG.info(entry.getValue() + " had " + wasRunning + " on shutdown");
|
||||
}
|
||||
}
|
||||
this.executorMap.clear();
|
||||
|
@ -255,9 +256,12 @@ public class ExecutorService {
|
|||
final BlockingQueue<Runnable> q = new LinkedBlockingQueue<Runnable>();
|
||||
private final String name;
|
||||
private final Map<EventHandler.EventType, EventHandlerListener> eventHandlerListeners;
|
||||
private static final AtomicLong seqids = new AtomicLong(0);
|
||||
private final long id;
|
||||
|
||||
protected Executor(String name, int maxThreads,
|
||||
final Map<EventHandler.EventType, EventHandlerListener> eventHandlerListeners) {
|
||||
this.id = seqids.incrementAndGet();
|
||||
this.name = name;
|
||||
this.eventHandlerListeners = eventHandlerListeners;
|
||||
// create the thread pool executor
|
||||
|
@ -283,5 +287,9 @@ public class ExecutorService {
|
|||
}
|
||||
this.threadPoolExecutor.execute(event);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + "-" + id + "-" + name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,15 @@ public class ClosedRegionHandler extends EventHandler implements TotesHRegionInf
|
|||
return this.regionInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String name = "UnknownServerName";
|
||||
if(server != null && server.getServerName() != null) {
|
||||
name = server.getServerName().toString();
|
||||
}
|
||||
return getClass().getSimpleName() + "-" + name + "-" + getSeqid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
LOG.debug("Handling CLOSED event for " + regionInfo.getEncodedName());
|
||||
|
|
|
@ -75,4 +75,13 @@ public class DeleteTableHandler extends TableEventHandler {
|
|||
// Call to undisableTable does this. TODO: Make a more formal purge table.
|
||||
am.getZKTable().setEnabledTable(Bytes.toString(tableName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String name = "UnknownServerName";
|
||||
if(server != null && server.getServerName() != null) {
|
||||
name = server.getServerName().toString();
|
||||
}
|
||||
return getClass().getSimpleName() + "-" + name + "-" + getSeqid() + "-" + tableNameStr;
|
||||
}
|
||||
}
|
|
@ -61,6 +61,15 @@ public class DisableTableHandler extends EventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String name = "UnknownServerName";
|
||||
if(server != null && server.getServerName() != null) {
|
||||
name = server.getServerName().toString();
|
||||
}
|
||||
return getClass().getSimpleName() + "-" + name + "-" + getSeqid() + "-" + tableNameStr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
try {
|
||||
|
|
|
@ -60,6 +60,15 @@ public class EnableTableHandler extends EventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String name = "UnknownServerName";
|
||||
if(server != null && server.getServerName() != null) {
|
||||
name = server.getServerName().toString();
|
||||
}
|
||||
return getClass().getSimpleName() + "-" + name + "-" + getSeqid() + "-" + tableNameStr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
try {
|
||||
|
|
|
@ -50,4 +50,13 @@ public class MetaServerShutdownHandler extends ServerShutdownHandler {
|
|||
boolean isCarryingMeta() {
|
||||
return this.carryingMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String name = "UnknownServerName";
|
||||
if(server != null && server.getServerName() != null) {
|
||||
name = server.getServerName().toString();
|
||||
}
|
||||
return getClass().getSimpleName() + "-" + name + "-" + getSeqid();
|
||||
}
|
||||
}
|
|
@ -49,4 +49,12 @@ public class ModifyTableHandler extends TableEventHandler {
|
|||
this.masterServices.getMasterFileSystem().updateRegionInfo(hri);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
String name = "UnknownServerName";
|
||||
if(server != null && server.getServerName() != null) {
|
||||
name = server.getServerName().toString();
|
||||
}
|
||||
return getClass().getSimpleName() + "-" + name + "-" + getSeqid() + "-" + tableNameStr;
|
||||
}
|
||||
}
|
|
@ -79,6 +79,15 @@ public class OpenedRegionHandler extends EventHandler implements TotesHRegionInf
|
|||
return this.regionInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String name = "UnknownServerName";
|
||||
if(server != null && server.getServerName() != null) {
|
||||
name = server.getServerName().toString();
|
||||
}
|
||||
return getClass().getSimpleName() + "-" + name + "-" + getSeqid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
LOG.debug("Handling OPENED event for " + this.regionInfo.getEncodedName() +
|
||||
|
|
|
@ -52,7 +52,6 @@ import org.apache.zookeeper.KeeperException;
|
|||
public class ServerShutdownHandler extends EventHandler {
|
||||
private static final Log LOG = LogFactory.getLog(ServerShutdownHandler.class);
|
||||
private final ServerName serverName;
|
||||
private final Server server;
|
||||
private final MasterServices services;
|
||||
private final DeadServer deadServers;
|
||||
|
||||
|
@ -107,6 +106,15 @@ public class ServerShutdownHandler extends EventHandler {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String name = "UnknownServerName";
|
||||
if(server != null && server.getServerName() != null) {
|
||||
name = server.getServerName().toString();
|
||||
}
|
||||
return getClass().getSimpleName() + "-" + name + "-" + getSeqid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process() throws IOException {
|
||||
final ServerName serverName = this.serverName;
|
||||
|
|
|
@ -60,6 +60,19 @@ public class SplitRegionHandler extends EventHandler implements TotesHRegionInfo
|
|||
return this.parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String name = "UnknownServerName";
|
||||
if(server != null && server.getServerName() != null) {
|
||||
name = server.getServerName().toString();
|
||||
}
|
||||
String parentRegion = "UnknownRegion";
|
||||
if(parent != null) {
|
||||
parentRegion = parent.getRegionNameAsString();
|
||||
}
|
||||
return getClass().getSimpleName() + "-" + name + "-" + getSeqid() + "-" + parentRegion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
LOG.debug("Handling SPLIT event for " + this.parent.getEncodedName() +
|
||||
|
|
|
@ -63,4 +63,16 @@ public class TableAddFamilyHandler extends TableEventHandler {
|
|||
this.masterServices.getMasterFileSystem().updateRegionInfo(hri);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
String name = "UnknownServerName";
|
||||
if(server != null && server.getServerName() != null) {
|
||||
name = server.getServerName().toString();
|
||||
}
|
||||
String family = "UnknownFamily";
|
||||
if(familyDesc != null) {
|
||||
family = familyDesc.getNameAsString();
|
||||
}
|
||||
return getClass().getSimpleName() + "-" + name + "-" + getSeqid() + "-" + tableNameStr + "-" + family;
|
||||
}
|
||||
}
|
|
@ -66,4 +66,16 @@ public class TableDeleteFamilyHandler extends TableEventHandler {
|
|||
this.masterServices.getMasterFileSystem().updateRegionInfo(hri);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
String name = "UnknownServerName";
|
||||
if(server != null && server.getServerName() != null) {
|
||||
name = server.getServerName().toString();
|
||||
}
|
||||
String family = "UnknownFamily";
|
||||
if(familyName != null) {
|
||||
family = Bytes.toString(familyName);
|
||||
}
|
||||
return getClass().getSimpleName() + "-" + name + "-" + getSeqid() + "-" + tableNameStr + "-" + family;
|
||||
}
|
||||
}
|
|
@ -62,4 +62,16 @@ public class TableModifyFamilyHandler extends TableEventHandler {
|
|||
this.masterServices.getMasterFileSystem().updateRegionInfo(hri);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
String name = "UnknownServerName";
|
||||
if(server != null && server.getServerName() != null) {
|
||||
name = server.getServerName().toString();
|
||||
}
|
||||
String family = "UnknownFamily";
|
||||
if(familyDesc != null) {
|
||||
family = familyDesc.getNameAsString();
|
||||
}
|
||||
return getClass().getSimpleName() + "-" + name + "-" + getSeqid() + "-" + tableNameStr + "-" + family;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue