hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1132466 - in /hbase/trunk: ./ src/main/java/org/apache/hadoop/hbase/executor/ src/main/java/org/apache/hadoop/hbase/master/handler/
Date Sun, 05 Jun 2011 18:02:35 GMT
Author: stack
Date: Sun Jun  5 18:02:34 2011
New Revision: 1132466

URL: http://svn.apache.org/viewvc?rev=1132466&view=rev
Log:
HBASE-3808 Implement Executor.toString for master handlers at least

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ClosedRegionHandler.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/DeleteTableHandler.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/DisableTableHandler.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/MetaServerShutdownHandler.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ModifyTableHandler.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/SplitRegionHandler.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableAddFamilyHandler.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableDeleteFamilyHandler.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableModifyFamilyHandler.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sun Jun  5 18:02:34 2011
@@ -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

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java Sun Jun
 5 18:02:34 2011
@@ -27,6 +27,7 @@ import java.util.concurrent.ConcurrentHa
 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;
+    }
   }
 }

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ClosedRegionHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ClosedRegionHandler.java?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ClosedRegionHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ClosedRegionHandler.java
Sun Jun  5 18:02:34 2011
@@ -79,6 +79,15 @@ public class ClosedRegionHandler extends
   }
 
   @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());
     // Check if this table is being disabled or not

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/DeleteTableHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/DeleteTableHandler.java?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/DeleteTableHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/DeleteTableHandler.java
Sun Jun  5 18:02:34 2011
@@ -75,4 +75,13 @@ public class DeleteTableHandler extends 
     // 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;
+  }
 }
\ No newline at end of file

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/DisableTableHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/DisableTableHandler.java?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/DisableTableHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/DisableTableHandler.java
Sun Jun  5 18:02:34 2011
@@ -62,6 +62,15 @@ public class DisableTableHandler extends
   }
 
   @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 {
       LOG.info("Attemping to disable table " + this.tableNameStr);

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
Sun Jun  5 18:02:34 2011
@@ -61,6 +61,15 @@ public class EnableTableHandler extends 
   }
 
   @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 {
       LOG.info("Attemping to enable the table " + this.tableNameStr);

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/MetaServerShutdownHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/MetaServerShutdownHandler.java?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/MetaServerShutdownHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/MetaServerShutdownHandler.java
Sun Jun  5 18:02:34 2011
@@ -50,4 +50,13 @@ public class MetaServerShutdownHandler e
   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();
+  }
 }
\ No newline at end of file

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ModifyTableHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ModifyTableHandler.java?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ModifyTableHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ModifyTableHandler.java
Sun Jun  5 18:02:34 2011
@@ -49,4 +49,12 @@ public class ModifyTableHandler extends 
       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;
+  }
 }
\ No newline at end of file

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java
Sun Jun  5 18:02:34 2011
@@ -78,7 +78,16 @@ public class OpenedRegionHandler extends
   public HRegionInfo getHRegionInfo() {
     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() +

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
Sun Jun  5 18:02:34 2011
@@ -52,7 +52,6 @@ import org.apache.zookeeper.KeeperExcept
 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;
 
@@ -108,6 +107,15 @@ public class ServerShutdownHandler exten
   }
 
   @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;
 

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/SplitRegionHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/SplitRegionHandler.java?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/SplitRegionHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/SplitRegionHandler.java
Sun Jun  5 18:02:34 2011
@@ -59,6 +59,19 @@ public class SplitRegionHandler extends 
   public HRegionInfo getHRegionInfo() {
     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() {

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableAddFamilyHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableAddFamilyHandler.java?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableAddFamilyHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableAddFamilyHandler.java
Sun Jun  5 18:02:34 2011
@@ -63,4 +63,16 @@ public class TableAddFamilyHandler exten
       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;
+  }
 }
\ No newline at end of file

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableDeleteFamilyHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableDeleteFamilyHandler.java?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableDeleteFamilyHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableDeleteFamilyHandler.java
Sun Jun  5 18:02:34 2011
@@ -66,4 +66,16 @@ public class TableDeleteFamilyHandler ex
       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;
+  }
 }
\ No newline at end of file

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableModifyFamilyHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableModifyFamilyHandler.java?rev=1132466&r1=1132465&r2=1132466&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableModifyFamilyHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/TableModifyFamilyHandler.java
Sun Jun  5 18:02:34 2011
@@ -62,4 +62,16 @@ public class TableModifyFamilyHandler ex
       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;
+  }
 }
\ No newline at end of file



Mime
View raw message