http://git-wip-us.apache.org/repos/asf/hbase/blob/16012f93/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
index 0623b2c..517ac3f 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
@@ -680,7 +680,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
         } else {
           // convert duplicate append to get
           List<Cell> results = region.get(ProtobufUtil.toGet(mutation, 
cellScanner), false,
-            nonceGroup, nonce);
+              nonceGroup, nonce);
           r = Result.create(results);
         }
         success = true;
@@ -731,7 +731,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
         } else {
           // convert duplicate increment to get
           List<Cell> results = region.get(ProtobufUtil.toGet(mutation, cells), 
false, nonceGroup,
-            nonce);
+              nonce);
           r = Result.create(results);
         }
         success = true;
@@ -2251,7 +2251,6 @@ public class RSRpcServices implements 
HBaseRPCErrorHandler,
       checkOpen();
       requestCount.increment();
       HRegion region = getRegion(request.getRegion());
-      boolean bypass = false;
       boolean loaded = false;
       Map<byte[], List<Path>> map = null;
 
@@ -2278,15 +2277,13 @@ public class RSRpcServices implements 
HBaseRPCErrorHandler,
           familyPaths.add(new Pair<>(familyPath.getFamily().toByteArray(), 
familyPath.getPath()));
         }
         if (region.getCoprocessorHost() != null) {
-          bypass = region.getCoprocessorHost().preBulkLoadHFile(familyPaths);
+          region.getCoprocessorHost().preBulkLoadHFile(familyPaths);
         }
         try {
-          if (!bypass) {
-            map = region.bulkLoadHFiles(familyPaths, 
request.getAssignSeqNum(), null,
-                request.getCopyFile());
-            if (map != null) {
-              loaded = true;
-            }
+          map = region.bulkLoadHFiles(familyPaths, request.getAssignSeqNum(), 
null,
+              request.getCopyFile());
+          if (map != null) {
+            loaded = true;
           }
         } finally {
           if (region.getCoprocessorHost() != null) {
@@ -2457,16 +2454,19 @@ public class RSRpcServices implements 
HBaseRPCErrorHandler,
   private Result get(Get get, HRegion region, RegionScannersCloseCallBack 
closeCallBack,
       RpcCallContext context) throws IOException {
     region.prepareGet(get);
-    List<Cell> results = new ArrayList<>();
     boolean stale = region.getRegionInfo().getReplicaId() != 0;
+
+    // This method is almost the same as HRegion#get.
+    List<Cell> results = new ArrayList<>();
+    long before = EnvironmentEdgeManager.currentTime();
     // pre-get CP hook
     if (region.getCoprocessorHost() != null) {
       if (region.getCoprocessorHost().preGet(get, results)) {
+        region.metricsUpdateForGet(results, before);
         return Result
             .create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : 
null, stale);
       }
     }
-    long before = EnvironmentEdgeManager.currentTime();
     Scan scan = new Scan(get);
     if (scan.getLoadColumnFamiliesOnDemandValue() == null) {
       scan.setLoadColumnFamiliesOnDemand(region.isLoadingCfsOnDemandDefault());
@@ -2498,6 +2498,7 @@ public class RSRpcServices implements 
HBaseRPCErrorHandler,
       region.getCoprocessorHost().postGet(get, results);
     }
     region.metricsUpdateForGet(results, before);
+
     return Result.create(results, get.isCheckExistenceOnly() ? 
!results.isEmpty() : null, stale);
   }
 
@@ -2729,11 +2730,10 @@ public class RSRpcServices implements 
HBaseRPCErrorHandler,
           byte[] qualifier = condition.getQualifier().toByteArray();
           CompareOperator compareOp =
             CompareOperator.valueOf(condition.getCompareType().name());
-          ByteArrayComparable comparator =
-            ProtobufUtil.toComparator(condition.getComparator());
+          ByteArrayComparable comparator = 
ProtobufUtil.toComparator(condition.getComparator());
           if (region.getCoprocessorHost() != null) {
-            processed = region.getCoprocessorHost().preCheckAndPut(
-              row, family, qualifier, compareOp, comparator, put);
+            processed = region.getCoprocessorHost().preCheckAndPut(row, 
family, qualifier,
+                compareOp, comparator, put);
           }
           if (processed == null) {
             boolean result = region.checkAndMutate(row, family,
@@ -2760,11 +2760,10 @@ public class RSRpcServices implements 
HBaseRPCErrorHandler,
           byte[] family = condition.getFamily().toByteArray();
           byte[] qualifier = condition.getQualifier().toByteArray();
           CompareOperator op = 
CompareOperator.valueOf(condition.getCompareType().name());
-          ByteArrayComparable comparator =
-            ProtobufUtil.toComparator(condition.getComparator());
+          ByteArrayComparable comparator = 
ProtobufUtil.toComparator(condition.getComparator());
           if (region.getCoprocessorHost() != null) {
-            processed = region.getCoprocessorHost().preCheckAndDelete(
-              row, family, qualifier, op, comparator, delete);
+            processed = region.getCoprocessorHost().preCheckAndDelete(row, 
family, qualifier, op,
+                comparator, delete);
           }
           if (processed == null) {
             boolean result = region.checkAndMutate(row, family,

http://git-wip-us.apache.org/repos/asf/hbase/blob/16012f93/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
index c5a3de3..43a01ba 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
@@ -473,14 +473,23 @@ public class RegionCoprocessorHost
   private ObserverGetter<RegionCoprocessor, EndpointObserver> 
endpointObserverGetter =
       RegionCoprocessor::getEndpointObserver;
 
-  abstract class RegionObserverOperation extends 
ObserverOperationWithoutResult<RegionObserver> {
-    public RegionObserverOperation() {
+  abstract class RegionObserverOperationWithoutResult extends
+      ObserverOperationWithoutResult<RegionObserver> {
+    public RegionObserverOperationWithoutResult() {
       super(regionObserverGetter);
     }
 
-    public RegionObserverOperation(User user) {
+    public RegionObserverOperationWithoutResult(User user) {
       super(regionObserverGetter, user);
     }
+
+    public RegionObserverOperationWithoutResult(boolean bypassable) {
+      super(regionObserverGetter, null, bypassable);
+    }
+
+    public RegionObserverOperationWithoutResult(User user, boolean bypassable) 
{
+      super(regionObserverGetter, user, bypassable);
+    }
   }
 
   abstract class BulkLoadObserverOperation extends
@@ -505,7 +514,10 @@ public class RegionCoprocessorHost
    * @throws IOException Signals that an I/O exception has occurred.
    */
   public void preOpen() throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    if (coprocEnvironments.isEmpty()) {
+      return;
+    }
+    execOperation(new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preOpen(this);
@@ -518,8 +530,11 @@ public class RegionCoprocessorHost
    * Invoked after a region open
    */
   public void postOpen() {
+    if (coprocEnvironments.isEmpty()) {
+      return;
+    }
     try {
-      execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+      execOperation(new RegionObserverOperationWithoutResult() {
         @Override
         public void call(RegionObserver observer) throws IOException {
           observer.postOpen(this);
@@ -534,8 +549,11 @@ public class RegionCoprocessorHost
    * Invoked after log replay on region
    */
   public void postLogReplay() {
+    if (coprocEnvironments.isEmpty()) {
+      return;
+    }
     try {
-      execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+      execOperation(new RegionObserverOperationWithoutResult() {
         @Override
         public void call(RegionObserver observer) throws IOException {
           observer.postLogReplay(this);
@@ -551,7 +569,7 @@ public class RegionCoprocessorHost
    * @param abortRequested true if the server is aborting
    */
   public void preClose(final boolean abortRequested) throws IOException {
-    execOperation(false, new RegionObserverOperation() {
+    execOperation(new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preClose(this, abortRequested);
@@ -565,7 +583,7 @@ public class RegionCoprocessorHost
    */
   public void postClose(final boolean abortRequested) {
     try {
-      execOperation(false, new RegionObserverOperation() {
+      execOperation(new RegionObserverOperationWithoutResult() {
         @Override
         public void call(RegionObserver observer) throws IOException {
           observer.postClose(this, abortRequested);
@@ -584,16 +602,21 @@ public class RegionCoprocessorHost
   /**
    * Called prior to selecting the {@link HStoreFile}s for compaction from the 
list of currently
    * available candidates.
+   * <p>Supports Coprocessor 'bypass' -- 'bypass' is how this method indicates 
that it changed
+   * the passed in <code>candidates</code>.
    * @param store The store where compaction is being requested
    * @param candidates The currently available store files
    * @param tracker used to track the life cycle of a compaction
    * @param user the user
-   * @return If {@code true}, skip the normal selection process and use the 
current list
    * @throws IOException
    */
   public boolean preCompactSelection(final HStore store, final 
List<HStoreFile> candidates,
       final CompactionLifeCycleTracker tracker, final User user) throws 
IOException {
-    return execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation(user) {
+    if (coprocEnvironments.isEmpty()) {
+      return false;
+    }
+    boolean bypassable = true;
+    return execOperation(new RegionObserverOperationWithoutResult(user, 
bypassable) {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preCompactSelection(this, store, candidates, tracker);
@@ -613,7 +636,10 @@ public class RegionCoprocessorHost
   public void postCompactSelection(final HStore store, final List<HStoreFile> 
selected,
       final CompactionLifeCycleTracker tracker, final CompactionRequest 
request,
       final User user) throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation(user) {
+    if (coprocEnvironments.isEmpty()) {
+      return;
+    }
+    execOperation(new RegionObserverOperationWithoutResult(user) {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postCompactSelection(this, store, selected, tracker, request);
@@ -626,8 +652,11 @@ public class RegionCoprocessorHost
    */
   public ScanInfo preCompactScannerOpen(HStore store, ScanType scanType,
       CompactionLifeCycleTracker tracker, CompactionRequest request, User 
user) throws IOException {
+    if (coprocEnvironments.isEmpty()) {
+      return store.getScanInfo();
+    }
     CustomizedScanInfoBuilder builder = new 
CustomizedScanInfoBuilder(store.getScanInfo());
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation(user) {
+    execOperation(new RegionObserverOperationWithoutResult(user) {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preCompactScannerOpen(this, store, scanType, builder, 
tracker, request);
@@ -646,12 +675,17 @@ public class RegionCoprocessorHost
    * @param user the user
    * @throws IOException
    */
+  // A Coprocessor can return null to cancel Compact. Leaving for now but this 
is form of 'bypass'.
   public InternalScanner preCompact(final HStore store, final InternalScanner 
scanner,
       final ScanType scanType, final CompactionLifeCycleTracker tracker,
       final CompactionRequest request, final User user) throws IOException {
-    return execOperationWithResult(false, scanner, 
coprocEnvironments.isEmpty() ? null :
-        new ObserverOperationWithResult<RegionObserver, InternalScanner>(
-            regionObserverGetter, user) {
+    InternalScanner defaultResult = scanner;
+    if (coprocEnvironments.isEmpty()) {
+      return defaultResult;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
InternalScanner>(regionObserverGetter,
+            defaultResult, user) {
           @Override
           public InternalScanner call(RegionObserver observer) throws 
IOException {
             return observer.preCompact(this, store, getResult(), scanType, 
tracker, request);
@@ -671,7 +705,7 @@ public class RegionCoprocessorHost
   public void postCompact(final HStore store, final HStoreFile resultFile,
       final CompactionLifeCycleTracker tracker, final CompactionRequest 
request, final User user)
       throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation(user) {
+    execOperation(coprocEnvironments.isEmpty()? null: new 
RegionObserverOperationWithoutResult(user) {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postCompact(this, store, resultFile, tracker, request);
@@ -681,12 +715,14 @@ public class RegionCoprocessorHost
 
   /**
    * Invoked before create StoreScanner for flush.
-   * @throws IOException
    */
   public ScanInfo preFlushScannerOpen(HStore store, FlushLifeCycleTracker 
tracker)
       throws IOException {
+    if (coprocEnvironments.isEmpty()) {
+      return store.getScanInfo();
+    }
     CustomizedScanInfoBuilder builder = new 
CustomizedScanInfoBuilder(store.getScanInfo());
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    execOperation(new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preFlushScannerOpen(this, store, builder, tracker);
@@ -699,10 +735,14 @@ public class RegionCoprocessorHost
    * Invoked before a memstore flush
    * @throws IOException
    */
+  // A Coprocessor can return null to cancel Flush. Leaving for now but this 
is a form of 'bypass'.
   public InternalScanner preFlush(HStore store, InternalScanner scanner,
       FlushLifeCycleTracker tracker) throws IOException {
-    return execOperationWithResult(false, scanner, 
coprocEnvironments.isEmpty() ? null
-        : new ObserverOperationWithResult<RegionObserver, 
InternalScanner>(regionObserverGetter) {
+    if (coprocEnvironments.isEmpty()) {
+      return scanner;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
InternalScanner>(regionObserverGetter, scanner) {
           @Override
           public InternalScanner call(RegionObserver observer) throws 
IOException {
             return observer.preFlush(this, store, getResult(), tracker);
@@ -715,7 +755,7 @@ public class RegionCoprocessorHost
    * @throws IOException
    */
   public void preFlush(FlushLifeCycleTracker tracker) throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    execOperation(coprocEnvironments.isEmpty()? null: new 
RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preFlush(this, tracker);
@@ -728,7 +768,7 @@ public class RegionCoprocessorHost
    * @throws IOException
    */
   public void postFlush(FlushLifeCycleTracker tracker) throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    execOperation(coprocEnvironments.isEmpty()? null: new 
RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postFlush(this, tracker);
@@ -742,7 +782,10 @@ public class RegionCoprocessorHost
    */
   public void postFlush(HStore store, HStoreFile storeFile, 
FlushLifeCycleTracker tracker)
       throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    if (coprocEnvironments.isEmpty()) {
+      return;
+    }
+    execOperation(new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postFlush(this, store, storeFile, tracker);
@@ -752,13 +795,18 @@ public class RegionCoprocessorHost
 
   // RegionObserver support
   /**
+   * Supports Coprocessor 'bypass'.
    * @param get the Get request
-   * @return true if default processing should be bypassed
+   * @param results What to return if return is true/'bypass'.
+   * @return true if default processing should be bypassed.
    * @exception IOException Exception
    */
-  public boolean preGet(final Get get, final List<Cell> results)
-      throws IOException {
-    return execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+  public boolean preGet(final Get get, final List<Cell> results) throws 
IOException {
+    if (coprocEnvironments.isEmpty()) {
+      return false;
+    }
+    boolean bypassable = true;
+    return execOperation(new RegionObserverOperationWithoutResult(bypassable) {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preGetOp(this, get, results);
@@ -768,12 +816,15 @@ public class RegionCoprocessorHost
 
   /**
    * @param get the Get request
-   * @param results the result sett
+   * @param results the result set
    * @exception IOException Exception
    */
   public void postGet(final Get get, final List<Cell> results)
       throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    if (coprocEnvironments.isEmpty()) {
+      return;
+    }
+    execOperation(new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postGetOp(this, get, results);
@@ -782,14 +833,20 @@ public class RegionCoprocessorHost
   }
 
   /**
+   * Supports Coprocessor 'bypass'.
    * @param get the Get request
-   * @return true or false to return to client if bypassing normal operation,
-   * or null otherwise
+   * @return true or false to return to client if bypassing normal operation, 
or null otherwise
    * @exception IOException Exception
    */
   public Boolean preExists(final Get get) throws IOException {
-    return execOperationWithResult(true, false, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter) {
+    boolean bypassable = true;
+    boolean defaultResult = false;
+    if (coprocEnvironments.isEmpty()) {
+      return null;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter,
+            defaultResult, bypassable) {
           @Override
           public Boolean call(RegionObserver observer) throws IOException {
             return observer.preExists(this, get, getResult());
@@ -799,14 +856,17 @@ public class RegionCoprocessorHost
 
   /**
    * @param get the Get request
-   * @param exists the result returned by the region server
+   * @param result the result returned by the region server
    * @return the result to return to the client
    * @exception IOException Exception
    */
-  public boolean postExists(final Get get, boolean exists)
+  public boolean postExists(final Get get, boolean result)
       throws IOException {
-    return execOperationWithResult(exists, coprocEnvironments.isEmpty() ? null 
:
-        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter) {
+    if (this.coprocEnvironments.isEmpty()) {
+      return result;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter, result) {
           @Override
           public Boolean call(RegionObserver observer) throws IOException {
             return observer.postExists(this, get, getResult());
@@ -815,6 +875,7 @@ public class RegionCoprocessorHost
   }
 
   /**
+   * Supports Coprocessor 'bypass'.
    * @param put The Put object
    * @param edit The WALEdit object.
    * @param durability The durability used
@@ -823,7 +884,11 @@ public class RegionCoprocessorHost
    */
   public boolean prePut(final Put put, final WALEdit edit, final Durability 
durability)
       throws IOException {
-    return execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    if (coprocEnvironments.isEmpty()) {
+      return false;
+    }
+    boolean bypassable = true;
+    return execOperation(new RegionObserverOperationWithoutResult(bypassable) {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.prePut(this, put, edit, durability);
@@ -832,21 +897,27 @@ public class RegionCoprocessorHost
   }
 
   /**
+   * Supports Coprocessor 'bypass'.
    * @param mutation - the current mutation
    * @param kv - the current cell
    * @param byteNow - current timestamp in bytes
    * @param get - the get that could be used
    * Note that the get only does not specify the family and qualifier that 
should be used
    * @return true if default processing should be bypassed
-   * @exception IOException
-   *              Exception
+   * @deprecated In hbase-2.0.0. Will be removed in hbase-3.0.0. Added 
explicitly for a single
+   * Coprocessor for its needs only. Will be removed.
    */
+  @Deprecated
   public boolean prePrepareTimeStampForDeleteVersion(final Mutation mutation,
       final Cell kv, final byte[] byteNow, final Get get) throws IOException {
-    return execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    if (coprocEnvironments.isEmpty()) {
+      return false;
+    }
+    boolean bypassable = true;
+    return execOperation(new RegionObserverOperationWithoutResult(bypassable) {
       @Override
       public void call(RegionObserver observer) throws IOException {
-        observer.prePrepareTimeStampForDeleteVersion(this, mutation, kv, 
byteNow, get);
+          observer.prePrepareTimeStampForDeleteVersion(this, mutation, kv, 
byteNow, get);
       }
     });
   }
@@ -859,7 +930,10 @@ public class RegionCoprocessorHost
    */
   public void postPut(final Put put, final WALEdit edit, final Durability 
durability)
       throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    if (coprocEnvironments.isEmpty()) {
+      return;
+    }
+    execOperation(new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postPut(this, put, edit, durability);
@@ -868,6 +942,7 @@ public class RegionCoprocessorHost
   }
 
   /**
+   * Supports Coprocessor 'bypass'.
    * @param delete The Delete object
    * @param edit The WALEdit object.
    * @param durability The durability used
@@ -876,10 +951,14 @@ public class RegionCoprocessorHost
    */
   public boolean preDelete(final Delete delete, final WALEdit edit, final 
Durability durability)
       throws IOException {
-    return execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    if (this.coprocEnvironments.isEmpty()) {
+      return false;
+    }
+    boolean bypassable = true;
+    return execOperation(new RegionObserverOperationWithoutResult(bypassable) {
       @Override
       public void call(RegionObserver observer) throws IOException {
-        observer.preDelete(this, delete, edit, durability);
+         observer.preDelete(this, delete, edit, durability);
       }
     });
   }
@@ -892,7 +971,8 @@ public class RegionCoprocessorHost
    */
   public void postDelete(final Delete delete, final WALEdit edit, final 
Durability durability)
       throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    execOperation(coprocEnvironments.isEmpty()? null:
+        new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postDelete(this, delete, edit, durability);
@@ -900,14 +980,12 @@ public class RegionCoprocessorHost
     });
   }
 
-  /**
-   * @param miniBatchOp
-   * @return true if default processing should be bypassed
-   * @throws IOException
-   */
-  public boolean preBatchMutate(
+  public void preBatchMutate(
       final MiniBatchOperationInProgress<Mutation> miniBatchOp) throws 
IOException {
-    return execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    if(this.coprocEnvironments.isEmpty()) {
+      return;
+    }
+    execOperation(new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preBatchMutate(this, miniBatchOp);
@@ -915,13 +993,12 @@ public class RegionCoprocessorHost
     });
   }
 
-  /**
-   * @param miniBatchOp
-   * @throws IOException
-   */
   public void postBatchMutate(
       final MiniBatchOperationInProgress<Mutation> miniBatchOp) throws 
IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    if (this.coprocEnvironments.isEmpty()) {
+      return;
+    }
+    execOperation(new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postBatchMutate(this, miniBatchOp);
@@ -932,7 +1009,10 @@ public class RegionCoprocessorHost
   public void postBatchMutateIndispensably(
       final MiniBatchOperationInProgress<Mutation> miniBatchOp, final boolean 
success)
       throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    if (this.coprocEnvironments.isEmpty()) {
+      return;
+    }
+    execOperation(new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postBatchMutateIndispensably(this, miniBatchOp, success);
@@ -941,22 +1021,28 @@ public class RegionCoprocessorHost
   }
 
   /**
+   * Supports Coprocessor 'bypass'.
    * @param row row to check
    * @param family column family
    * @param qualifier column qualifier
    * @param op the comparison operation
    * @param comparator the comparator
    * @param put data to put if check succeeds
-   * @return true or false to return to client if default processing should
-   * be bypassed, or null otherwise
-   * @throws IOException e
+   * @return true or false to return to client if default processing should be 
bypassed, or null
+   * otherwise
    */
   public Boolean preCheckAndPut(final byte [] row, final byte [] family,
       final byte [] qualifier, final CompareOperator op,
       final ByteArrayComparable comparator, final Put put)
       throws IOException {
-    return execOperationWithResult(true, false, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter) {
+    boolean bypassable = true;
+    boolean defaultResult = false;
+    if (coprocEnvironments.isEmpty()) {
+      return null;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter,
+            defaultResult,  bypassable) {
           @Override
           public Boolean call(RegionObserver observer) throws IOException {
             return observer.preCheckAndPut(this, row, family, qualifier,
@@ -966,21 +1052,27 @@ public class RegionCoprocessorHost
   }
 
   /**
+   * Supports Coprocessor 'bypass'.
    * @param row row to check
    * @param family column family
    * @param qualifier column qualifier
    * @param op the comparison operation
    * @param comparator the comparator
    * @param put data to put if check succeeds
-   * @return true or false to return to client if default processing should
-   * be bypassed, or null otherwise
-   * @throws IOException e
+   * @return true or false to return to client if default processing should be 
bypassed, or null
+   * otherwise
    */
   public Boolean preCheckAndPutAfterRowLock(
       final byte[] row, final byte[] family, final byte[] qualifier, final 
CompareOperator op,
       final ByteArrayComparable comparator, final Put put) throws IOException {
-    return execOperationWithResult(true, false, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter) {
+    boolean bypassable = true;
+    boolean defaultResult = false;
+    if (coprocEnvironments.isEmpty()) {
+      return null;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter,
+            defaultResult, bypassable) {
           @Override
           public Boolean call(RegionObserver observer) throws IOException {
             return observer.preCheckAndPutAfterRowLock(this, row, family, 
qualifier,
@@ -1002,8 +1094,11 @@ public class RegionCoprocessorHost
       final byte [] qualifier, final CompareOperator op,
       final ByteArrayComparable comparator, final Put put,
       boolean result) throws IOException {
-    return execOperationWithResult(result, coprocEnvironments.isEmpty() ? null 
:
-        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter) {
+    if (this.coprocEnvironments.isEmpty()) {
+      return result;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter, result) {
           @Override
           public Boolean call(RegionObserver observer) throws IOException {
             return observer.postCheckAndPut(this, row, family, qualifier,
@@ -1013,22 +1108,28 @@ public class RegionCoprocessorHost
   }
 
   /**
+   * Supports Coprocessor 'bypass'.
    * @param row row to check
    * @param family column family
    * @param qualifier column qualifier
    * @param op the comparison operation
    * @param comparator the comparator
    * @param delete delete to commit if check succeeds
-   * @return true or false to return to client if default processing should
-   * be bypassed, or null otherwise
-   * @throws IOException e
+   * @return true or false to return to client if default processing should be 
bypassed,
+   * or null otherwise
    */
   public Boolean preCheckAndDelete(final byte [] row, final byte [] family,
       final byte [] qualifier, final CompareOperator op,
       final ByteArrayComparable comparator, final Delete delete)
       throws IOException {
-    return execOperationWithResult(true, false, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter) {
+    boolean bypassable = true;
+    boolean defaultResult = false;
+    if (coprocEnvironments.isEmpty()) {
+      return null;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter,
+            defaultResult, bypassable) {
           @Override
           public Boolean call(RegionObserver observer) throws IOException {
             return observer.preCheckAndDelete(this, row, family,
@@ -1038,21 +1139,27 @@ public class RegionCoprocessorHost
   }
 
   /**
+   * Supports Coprocessor 'bypass'.
    * @param row row to check
    * @param family column family
    * @param qualifier column qualifier
    * @param op the comparison operation
    * @param comparator the comparator
    * @param delete delete to commit if check succeeds
-   * @return true or false to return to client if default processing should
-   * be bypassed, or null otherwise
-   * @throws IOException e
+   * @return true or false to return to client if default processing should be 
bypassed,
+   * or null otherwise
    */
   public Boolean preCheckAndDeleteAfterRowLock(final byte[] row, final byte[] 
family,
       final byte[] qualifier, final CompareOperator op, final 
ByteArrayComparable comparator,
       final Delete delete) throws IOException {
-    return execOperationWithResult(true, false, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter) {
+    boolean bypassable = true;
+    boolean defaultResult = false;
+    if (coprocEnvironments.isEmpty()) {
+      return null;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter,
+            defaultResult, bypassable) {
           @Override
           public Boolean call(RegionObserver observer) throws IOException {
             return observer.preCheckAndDeleteAfterRowLock(this, row,
@@ -1074,8 +1181,11 @@ public class RegionCoprocessorHost
       final byte [] qualifier, final CompareOperator op,
       final ByteArrayComparable comparator, final Delete delete,
       boolean result) throws IOException {
-    return execOperationWithResult(result, coprocEnvironments.isEmpty() ? null 
:
-        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter) {
+    if (this.coprocEnvironments.isEmpty()) {
+      return result;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter, result) {
           @Override
           public Boolean call(RegionObserver observer) throws IOException {
             return observer.postCheckAndDelete(this, row, family,
@@ -1085,14 +1195,20 @@ public class RegionCoprocessorHost
   }
 
   /**
+   * Supports Coprocessor 'bypass'.
    * @param append append object
-   * @return result to return to client if default operation should be
-   * bypassed, null otherwise
+   * @return result to return to client if default operation should be 
bypassed, null otherwise
    * @throws IOException if an error occurred on the coprocessor
    */
   public Result preAppend(final Append append) throws IOException {
-    return execOperationWithResult(true, null, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
Result>(regionObserverGetter) {
+    boolean bypassable = true;
+    Result defaultResult = null;
+    if (this.coprocEnvironments.isEmpty()) {
+      return defaultResult;
+    }
+    return execOperationWithResult(
+      new ObserverOperationWithResult<RegionObserver, 
Result>(regionObserverGetter, defaultResult,
+            bypassable) {
           @Override
           public Result call(RegionObserver observer) throws IOException {
             return observer.preAppend(this, append);
@@ -1101,14 +1217,20 @@ public class RegionCoprocessorHost
   }
 
   /**
+   * Supports Coprocessor 'bypass'.
    * @param append append object
-   * @return result to return to client if default operation should be
-   * bypassed, null otherwise
+   * @return result to return to client if default operation should be 
bypassed, null otherwise
    * @throws IOException if an error occurred on the coprocessor
    */
   public Result preAppendAfterRowLock(final Append append) throws IOException {
-    return execOperationWithResult(true, null, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
Result>(regionObserverGetter) {
+    boolean bypassable = true;
+    Result defaultResult = null;
+    if (this.coprocEnvironments.isEmpty()) {
+      return defaultResult;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Result>(regionObserverGetter,
+            defaultResult, bypassable) {
           @Override
           public Result call(RegionObserver observer) throws IOException {
             return observer.preAppendAfterRowLock(this, append);
@@ -1117,14 +1239,20 @@ public class RegionCoprocessorHost
   }
 
   /**
+   * Supports Coprocessor 'bypass'.
    * @param increment increment object
-   * @return result to return to client if default operation should be
-   * bypassed, null otherwise
+   * @return result to return to client if default operation should be 
bypassed, null otherwise
    * @throws IOException if an error occurred on the coprocessor
    */
   public Result preIncrement(final Increment increment) throws IOException {
-    return execOperationWithResult(true, null, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
Result>(regionObserverGetter) {
+    boolean bypassable = true;
+    Result defaultResult = null;
+    if (coprocEnvironments.isEmpty()) {
+      return defaultResult;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Result>(regionObserverGetter, defaultResult,
+            bypassable) {
           @Override
           public Result call(RegionObserver observer) throws IOException {
             return observer.preIncrement(this, increment);
@@ -1133,14 +1261,20 @@ public class RegionCoprocessorHost
   }
 
   /**
+   * Supports Coprocessor 'bypass'.
    * @param increment increment object
-   * @return result to return to client if default operation should be
-   * bypassed, null otherwise
+   * @return result to return to client if default operation should be 
bypassed, null otherwise
    * @throws IOException if an error occurred on the coprocessor
    */
   public Result preIncrementAfterRowLock(final Increment increment) throws 
IOException {
-    return execOperationWithResult(true, null, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
Result>(regionObserverGetter) {
+    boolean bypassable = true;
+    Result defaultResult = null;
+    if (coprocEnvironments.isEmpty()) {
+      return defaultResult;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Result>(regionObserverGetter, defaultResult,
+            bypassable) {
           @Override
           public Result call(RegionObserver observer) throws IOException {
             return observer.preIncrementAfterRowLock(this, increment);
@@ -1154,8 +1288,11 @@ public class RegionCoprocessorHost
    * @throws IOException if an error occurred on the coprocessor
    */
   public Result postAppend(final Append append, final Result result) throws 
IOException {
-    return execOperationWithResult(result, coprocEnvironments.isEmpty() ? null 
:
-        new ObserverOperationWithResult<RegionObserver, 
Result>(regionObserverGetter) {
+    if (this.coprocEnvironments.isEmpty()) {
+      return result;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Result>(regionObserverGetter, result) {
           @Override
           public Result call(RegionObserver observer) throws IOException {
             return observer.postAppend(this, append, result);
@@ -1169,8 +1306,11 @@ public class RegionCoprocessorHost
    * @throws IOException if an error occurred on the coprocessor
    */
   public Result postIncrement(final Increment increment, Result result) throws 
IOException {
-    return execOperationWithResult(result, coprocEnvironments.isEmpty() ? null 
:
-        new ObserverOperationWithResult<RegionObserver, 
Result>(regionObserverGetter) {
+    if (this.coprocEnvironments.isEmpty()) {
+      return result;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Result>(regionObserverGetter, result) {
           @Override
           public Result call(RegionObserver observer) throws IOException {
             return observer.postIncrement(this, increment, getResult());
@@ -1183,7 +1323,7 @@ public class RegionCoprocessorHost
    * @exception IOException Exception
    */
   public void preScannerOpen(final Scan scan) throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    execOperation(coprocEnvironments.isEmpty()? null: new 
RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preScannerOpen(this, scan);
@@ -1198,8 +1338,11 @@ public class RegionCoprocessorHost
    * @exception IOException Exception
    */
   public RegionScanner postScannerOpen(final Scan scan, RegionScanner s) 
throws IOException {
-    return execOperationWithResult(s, coprocEnvironments.isEmpty() ? null :
-        new ObserverOperationWithResult<RegionObserver, 
RegionScanner>(regionObserverGetter) {
+    if (this.coprocEnvironments.isEmpty()) {
+      return s;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
RegionScanner>(regionObserverGetter, s) {
           @Override
           public RegionScanner call(RegionObserver observer) throws 
IOException {
             return observer.postScannerOpen(this, scan, getResult());
@@ -1211,14 +1354,19 @@ public class RegionCoprocessorHost
    * @param s the scanner
    * @param results the result set returned by the region server
    * @param limit the maximum number of results to return
-   * @return 'has next' indication to client if bypassing default behavior, or
-   * null otherwise
+   * @return 'has next' indication to client if bypassing default behavior, or 
null otherwise
    * @exception IOException Exception
    */
   public Boolean preScannerNext(final InternalScanner s,
       final List<Result> results, final int limit) throws IOException {
-    return execOperationWithResult(true, false, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter) {
+    boolean bypassable = true;
+    boolean defaultResult = false;
+    if (coprocEnvironments.isEmpty()) {
+      return null;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter,
+            defaultResult, bypassable) {
           @Override
           public Boolean call(RegionObserver observer) throws IOException {
             return observer.preScannerNext(this, s, results, limit, 
getResult());
@@ -1237,8 +1385,11 @@ public class RegionCoprocessorHost
   public boolean postScannerNext(final InternalScanner s,
       final List<Result> results, final int limit, boolean hasMore)
       throws IOException {
-    return execOperationWithResult(hasMore, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter) {
+    if (this.coprocEnvironments.isEmpty()) {
+      return hasMore;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter, hasMore) {
           @Override
           public Boolean call(RegionObserver observer) throws IOException {
             return observer.postScannerNext(this, s, results, limit, 
getResult());
@@ -1257,23 +1408,32 @@ public class RegionCoprocessorHost
   public boolean postScannerFilterRow(final InternalScanner s, final Cell 
curRowCell)
       throws IOException {
     // short circuit for performance
-    if (!hasCustomPostScannerFilterRow) return true;
-    return execOperationWithResult(true, coprocEnvironments.isEmpty() ? null :
-        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter) {
-          @Override
-          public Boolean call(RegionObserver observer) throws IOException {
-            return observer.postScannerFilterRow(this, s, curRowCell, 
getResult());
-          }
-        });
+    boolean defaultResult = true;
+    if (!hasCustomPostScannerFilterRow) {
+      return defaultResult;
+    }
+    if (this.coprocEnvironments.isEmpty()) {
+      return defaultResult;
+    }
+    return execOperationWithResult(new 
ObserverOperationWithResult<RegionObserver, Boolean>(
+        regionObserverGetter, defaultResult) {
+      @Override
+      public Boolean call(RegionObserver observer) throws IOException {
+        return observer.postScannerFilterRow(this, s, curRowCell, getResult());
+      }
+    });
   }
 
   /**
+   * Supports Coprocessor 'bypass'.
    * @param s the scanner
    * @return true if default behavior should be bypassed, false otherwise
    * @exception IOException Exception
    */
+  // Should this be bypassable?
   public boolean preScannerClose(final InternalScanner s) throws IOException {
-    return execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    return execOperation(coprocEnvironments.isEmpty()? null:
+        new RegionObserverOperationWithoutResult(true) {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preScannerClose(this, s);
@@ -1285,7 +1445,8 @@ public class RegionCoprocessorHost
    * @exception IOException Exception
    */
   public void postScannerClose(final InternalScanner s) throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    execOperation(coprocEnvironments.isEmpty()? null:
+        new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postScannerClose(this, s);
@@ -1297,8 +1458,9 @@ public class RegionCoprocessorHost
    * Called before open store scanner for user scan.
    */
   public ScanInfo preStoreScannerOpen(HStore store) throws IOException {
+    if (coprocEnvironments.isEmpty()) return store.getScanInfo();
     CustomizedScanInfoBuilder builder = new 
CustomizedScanInfoBuilder(store.getScanInfo());
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    execOperation(new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preStoreScannerOpen(this, store, builder);
@@ -1310,10 +1472,10 @@ public class RegionCoprocessorHost
   /**
    * @param info the RegionInfo for this region
    * @param edits the file of recovered edits
-   * @throws IOException Exception
    */
   public void preReplayWALs(final RegionInfo info, final Path edits) throws 
IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    execOperation(coprocEnvironments.isEmpty()? null:
+        new RegionObserverOperationWithoutResult(true) {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preReplayWALs(this, info, edits);
@@ -1327,7 +1489,8 @@ public class RegionCoprocessorHost
    * @throws IOException Exception
    */
   public void postReplayWALs(final RegionInfo info, final Path edits) throws 
IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    execOperation(coprocEnvironments.isEmpty()? null:
+        new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postReplayWALs(this, info, edits);
@@ -1336,15 +1499,16 @@ public class RegionCoprocessorHost
   }
 
   /**
-   * @param info
-   * @param logKey
-   * @param logEdit
+   * Supports Coprocessor 'bypass'.
    * @return true if default behavior should be bypassed, false otherwise
-   * @throws IOException
+   * @deprecated Since hbase-2.0.0. No replacement. To be removed in 
hbase-3.0.0 and replaced
+   * with something that doesn't expose IntefaceAudience.Private classes.
    */
-  public boolean preWALRestore(final RegionInfo info, final WALKey logKey,
-      final WALEdit logEdit) throws IOException {
-    return execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+  @Deprecated
+  public boolean preWALRestore(final RegionInfo info, final WALKey logKey, 
final WALEdit logEdit)
+      throws IOException {
+    return execOperation(coprocEnvironments.isEmpty()? null:
+        new RegionObserverOperationWithoutResult(true) {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preWALRestore(this, info, logKey, logEdit);
@@ -1353,14 +1517,14 @@ public class RegionCoprocessorHost
   }
 
   /**
-   * @param info
-   * @param logKey
-   * @param logEdit
-   * @throws IOException
+   * @deprecated Since hbase-2.0.0. No replacement. To be removed in 
hbase-3.0.0 and replaced
+   * with something that doesn't expose IntefaceAudience.Private classes.
    */
+  @Deprecated
   public void postWALRestore(final RegionInfo info, final WALKey logKey, final 
WALEdit logEdit)
       throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    execOperation(coprocEnvironments.isEmpty()? null:
+        new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postWALRestore(this, info, logKey, logEdit);
@@ -1370,11 +1534,9 @@ public class RegionCoprocessorHost
 
   /**
    * @param familyPaths pairs of { CF, file path } submitted for bulk load
-   * @return true if the default operation should be bypassed
-   * @throws IOException
    */
-  public boolean preBulkLoadHFile(final List<Pair<byte[], String>> 
familyPaths) throws IOException {
-    return execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+  public void preBulkLoadHFile(final List<Pair<byte[], String>> familyPaths) 
throws IOException {
+    execOperation(coprocEnvironments.isEmpty()? null: new 
RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preBulkLoadHFile(this, familyPaths);
@@ -1384,15 +1546,18 @@ public class RegionCoprocessorHost
 
   public boolean preCommitStoreFile(final byte[] family, final List<Pair<Path, 
Path>> pairs)
       throws IOException {
-    return execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    return execOperation(coprocEnvironments.isEmpty()? null:
+        new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.preCommitStoreFile(this, family, pairs);
       }
     });
   }
+
   public void postCommitStoreFile(final byte[] family, Path srcPath, Path 
dstPath) throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    execOperation(coprocEnvironments.isEmpty()? null:
+        new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postCommitStoreFile(this, family, srcPath, dstPath);
@@ -1403,14 +1568,17 @@ public class RegionCoprocessorHost
   /**
    * @param familyPaths pairs of { CF, file path } submitted for bulk load
    * @param map Map of CF to List of file paths for the final loaded files
-   * @param hasLoaded whether load was successful or not
+   * @param result whether load was successful or not
    * @return the possibly modified value of hasLoaded
    * @throws IOException
    */
   public boolean postBulkLoadHFile(final List<Pair<byte[], String>> 
familyPaths,
-      Map<byte[], List<Path>> map, boolean hasLoaded) throws IOException {
-    return execOperationWithResult(hasLoaded, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter) {
+      Map<byte[], List<Path>> map, boolean result) throws IOException {
+    if (this.coprocEnvironments.isEmpty()) {
+      return result;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Boolean>(regionObserverGetter, result) {
           @Override
           public Boolean call(RegionObserver observer) throws IOException {
             return observer.postBulkLoadHFile(this, familyPaths, map, 
getResult());
@@ -1419,7 +1587,8 @@ public class RegionCoprocessorHost
   }
 
   public void postStartRegionOperation(final Operation op) throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    execOperation(coprocEnvironments.isEmpty()? null:
+        new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postStartRegionOperation(this, op);
@@ -1428,7 +1597,8 @@ public class RegionCoprocessorHost
   }
 
   public void postCloseRegionOperation(final Operation op) throws IOException {
-    execOperation(coprocEnvironments.isEmpty() ? null : new 
RegionObserverOperation() {
+    execOperation(coprocEnvironments.isEmpty()? null:
+        new RegionObserverOperationWithoutResult() {
       @Override
       public void call(RegionObserver observer) throws IOException {
         observer.postCloseRegionOperation(this, op);
@@ -1450,8 +1620,11 @@ public class RegionCoprocessorHost
   public StoreFileReader preStoreFileReaderOpen(final FileSystem fs, final 
Path p,
       final FSDataInputStreamWrapper in, final long size, final CacheConfig 
cacheConf,
       final Reference r) throws IOException {
-    return execOperationWithResult(null, coprocEnvironments.isEmpty() ? null :
-        new ObserverOperationWithResult<RegionObserver, 
StoreFileReader>(regionObserverGetter) {
+    if (coprocEnvironments.isEmpty()) {
+      return null;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
StoreFileReader>(regionObserverGetter, null) {
           @Override
           public StoreFileReader call(RegionObserver observer) throws 
IOException {
             return observer.preStoreFileReaderOpen(this, fs, p, in, size, 
cacheConf, r,
@@ -1474,8 +1647,11 @@ public class RegionCoprocessorHost
   public StoreFileReader postStoreFileReaderOpen(final FileSystem fs, final 
Path p,
       final FSDataInputStreamWrapper in, final long size, final CacheConfig 
cacheConf,
       final Reference r, final StoreFileReader reader) throws IOException {
-    return execOperationWithResult(reader, coprocEnvironments.isEmpty() ? null 
:
-        new ObserverOperationWithResult<RegionObserver, 
StoreFileReader>(regionObserverGetter) {
+    if (this.coprocEnvironments.isEmpty()) {
+      return reader;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
StoreFileReader>(regionObserverGetter, reader) {
           @Override
           public StoreFileReader call(RegionObserver observer) throws 
IOException {
             return observer.postStoreFileReaderOpen(this, fs, p, in, size, 
cacheConf, r,
@@ -1486,8 +1662,11 @@ public class RegionCoprocessorHost
 
   public Cell postMutationBeforeWAL(final MutationType opType, final Mutation 
mutation,
       final Cell oldCell, Cell newCell) throws IOException {
-    return execOperationWithResult(newCell, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
Cell>(regionObserverGetter) {
+    if (this.coprocEnvironments.isEmpty()) {
+      return newCell;
+    }
+    return execOperationWithResult(
+        new ObserverOperationWithResult<RegionObserver, 
Cell>(regionObserverGetter, newCell) {
           @Override
           public Cell call(RegionObserver observer) throws IOException {
             return observer.postMutationBeforeWAL(this, opType, mutation, 
oldCell, getResult());
@@ -1497,13 +1676,16 @@ public class RegionCoprocessorHost
 
   public Message preEndpointInvocation(final Service service, final String 
methodName,
       Message request) throws IOException {
-    return execOperationWithResult(request, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<EndpointObserver, 
Message>(endpointObserverGetter) {
-          @Override
-          public Message call(EndpointObserver observer) throws IOException {
-            return observer.preEndpointInvocation(this, service, methodName, 
getResult());
-          }
-        });
+    if (coprocEnvironments.isEmpty()) {
+      return request;
+    }
+    return execOperationWithResult(new 
ObserverOperationWithResult<EndpointObserver,
+        Message>(endpointObserverGetter, request) {
+      @Override
+      public Message call(EndpointObserver observer) throws IOException {
+        return observer.preEndpointInvocation(this, service, methodName, 
getResult());
+      }
+    });
   }
 
   public void postEndpointInvocation(final Service service, final String 
methodName,
@@ -1517,14 +1699,21 @@ public class RegionCoprocessorHost
         });
   }
 
-  public DeleteTracker postInstantiateDeleteTracker(DeleteTracker tracker) 
throws IOException {
-    return execOperationWithResult(tracker, coprocEnvironments.isEmpty() ? 
null :
-        new ObserverOperationWithResult<RegionObserver, 
DeleteTracker>(regionObserverGetter) {
-          @Override
-          public DeleteTracker call(RegionObserver observer) throws 
IOException {
-            return observer.postInstantiateDeleteTracker(this, getResult());
-          }
-        });
+  /**
+   * @deprecated Since 2.0 with out any replacement and will be removed in 3.0
+   */
+  @Deprecated
+  public DeleteTracker postInstantiateDeleteTracker(DeleteTracker result) 
throws IOException {
+    if (this.coprocEnvironments.isEmpty()) {
+      return result;
+    }
+    return execOperationWithResult(new 
ObserverOperationWithResult<RegionObserver, DeleteTracker>(
+        regionObserverGetter, result) {
+      @Override
+      public DeleteTracker call(RegionObserver observer) throws IOException {
+        return observer.postInstantiateDeleteTracker(this, getResult());
+      }
+    });
   }
 
   
/////////////////////////////////////////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/hbase/blob/16012f93/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerCoprocessorHost.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerCoprocessorHost.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerCoprocessorHost.java
index 27a3e20..fd5efba 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerCoprocessorHost.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerCoprocessorHost.java
@@ -115,7 +115,10 @@ public class RegionServerCoprocessorHost extends
   public void preStop(String message, User user) throws IOException {
     // While stopping the region server all coprocessors method should be 
executed first then the
     // coprocessor should be cleaned up.
-    execShutdown(coprocEnvironments.isEmpty() ? null : new 
RegionServerObserverOperation(user) {
+    if (coprocEnvironments.isEmpty()) {
+      return;
+    }
+    execShutdown(new RegionServerObserverOperation(user) {
       @Override
       public void call(RegionServerObserver observer) throws IOException {
         observer.preStopRegionServer(this);
@@ -169,9 +172,12 @@ public class RegionServerCoprocessorHost extends
 
   public ReplicationEndpoint postCreateReplicationEndPoint(final 
ReplicationEndpoint endpoint)
       throws IOException {
-    return execOperationWithResult(endpoint, coprocEnvironments.isEmpty() ? 
null :
+    if (this.coprocEnvironments.isEmpty()) {
+      return endpoint;
+    }
+    return execOperationWithResult(
         new ObserverOperationWithResult<RegionServerObserver, 
ReplicationEndpoint>(
-            rsObserverGetter) {
+            rsObserverGetter, endpoint) {
       @Override
       public ReplicationEndpoint call(RegionServerObserver observer) throws 
IOException {
         return observer.postCreateReplicationEndPoint(this, getResult());

http://git-wip-us.apache.org/repos/asf/hbase/blob/16012f93/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SecureBulkLoadManager.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SecureBulkLoadManager.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SecureBulkLoadManager.java
index 653ec75..6ce44fe 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SecureBulkLoadManager.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SecureBulkLoadManager.java
@@ -192,57 +192,54 @@ public class SecureBulkLoadManager {
       throw new DoNotRetryIOException("User token cannot be null");
     }
 
-    boolean bypass = false;
     if (region.getCoprocessorHost() != null) {
-        bypass = region.getCoprocessorHost().preBulkLoadHFile(familyPaths);
+      region.getCoprocessorHost().preBulkLoadHFile(familyPaths);
     }
     boolean loaded = false;
     Map<byte[], List<Path>> map = null;
 
     try {
-      if (!bypass) {
-        // Get the target fs (HBase region server fs) delegation token
-        // Since we have checked the permission via 'preBulkLoadHFile', now 
let's give
-        // the 'request user' necessary token to operate on the target fs.
-        // After this point the 'doAs' user will hold two tokens, one for the 
source fs
-        // ('request user'), another for the target fs (HBase region server 
principal).
-        if (userProvider.isHadoopSecurityEnabled()) {
-          FsDelegationToken targetfsDelegationToken = new 
FsDelegationToken(userProvider,"renewer");
-          targetfsDelegationToken.acquireDelegationToken(fs);
-
-          Token<?> targetFsToken = targetfsDelegationToken.getUserToken();
-          if (targetFsToken != null
-              && (userToken == null || 
!targetFsToken.getService().equals(userToken.getService()))){
-            ugi.addToken(targetFsToken);
-          }
+      // Get the target fs (HBase region server fs) delegation token
+      // Since we have checked the permission via 'preBulkLoadHFile', now 
let's give
+      // the 'request user' necessary token to operate on the target fs.
+      // After this point the 'doAs' user will hold two tokens, one for the 
source fs
+      // ('request user'), another for the target fs (HBase region server 
principal).
+      if (userProvider.isHadoopSecurityEnabled()) {
+        FsDelegationToken targetfsDelegationToken = new 
FsDelegationToken(userProvider,"renewer");
+        targetfsDelegationToken.acquireDelegationToken(fs);
+
+        Token<?> targetFsToken = targetfsDelegationToken.getUserToken();
+        if (targetFsToken != null
+            && (userToken == null || 
!targetFsToken.getService().equals(userToken.getService()))){
+          ugi.addToken(targetFsToken);
         }
+      }
 
-        map = ugi.doAs(new PrivilegedAction<Map<byte[], List<Path>>>() {
-          @Override
-          public Map<byte[], List<Path>> run() {
-            FileSystem fs = null;
-            try {
-              fs = FileSystem.get(conf);
-              for(Pair<byte[], String> el: familyPaths) {
-                Path stageFamily = new Path(bulkToken, 
Bytes.toString(el.getFirst()));
-                if(!fs.exists(stageFamily)) {
-                  fs.mkdirs(stageFamily);
-                  fs.setPermission(stageFamily, PERM_ALL_ACCESS);
-                }
+      map = ugi.doAs(new PrivilegedAction<Map<byte[], List<Path>>>() {
+        @Override
+        public Map<byte[], List<Path>> run() {
+          FileSystem fs = null;
+          try {
+            fs = FileSystem.get(conf);
+            for(Pair<byte[], String> el: familyPaths) {
+              Path stageFamily = new Path(bulkToken, 
Bytes.toString(el.getFirst()));
+              if(!fs.exists(stageFamily)) {
+                fs.mkdirs(stageFamily);
+                fs.setPermission(stageFamily, PERM_ALL_ACCESS);
               }
-              //We call bulkLoadHFiles as requesting user
-              //To enable access prior to staging
-              return region.bulkLoadHFiles(familyPaths, true,
-                  new SecureBulkLoadListener(fs, bulkToken, conf), 
request.getCopyFile());
-            } catch (Exception e) {
-              LOG.error("Failed to complete bulk load", e);
             }
-            return null;
+            //We call bulkLoadHFiles as requesting user
+            //To enable access prior to staging
+            return region.bulkLoadHFiles(familyPaths, true,
+                new SecureBulkLoadListener(fs, bulkToken, conf), 
request.getCopyFile());
+          } catch (Exception e) {
+            LOG.error("Failed to complete bulk load", e);
           }
-        });
-        if (map != null) {
-          loaded = true;
+          return null;
         }
+      });
+      if (map != null) {
+        loaded = true;
       }
     } finally {
       if (region.getCoprocessorHost() != null) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/16012f93/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java
index f8b27c0..61c7100 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java
@@ -909,12 +909,7 @@ public abstract class AbstractFSWAL<W extends WriterBase> 
implements WAL {
     }
 
     // Coprocessor hook.
-    if (!coprocessorHost.preWALWrite(entry.getRegionInfo(), entry.getKey(), 
entry.getEdit())) {
-      if (entry.getEdit().isReplay()) {
-        // Set replication scope null so that this won't be replicated
-        entry.getKey().serializeReplicationScope(false);
-      }
-    }
+    coprocessorHost.preWALWrite(entry.getRegionInfo(), entry.getKey(), 
entry.getEdit());
     if (!listeners.isEmpty()) {
       for (WALActionsListener i : listeners) {
         i.visitLogEntryBeforeWrite(entry.getKey(), entry.getEdit());

http://git-wip-us.apache.org/repos/asf/hbase/blob/16012f93/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCoprocessorHost.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCoprocessorHost.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCoprocessorHost.java
index 34f93fa..d28c3c4 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCoprocessorHost.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCoprocessorHost.java
@@ -139,31 +139,29 @@ public class WALCoprocessorHost
     }
   }
 
-
   /**
-   * @param info
-   * @param logKey
-   * @param logEdit
-   * @return true if default behavior should be bypassed, false otherwise
-   * @throws IOException
+   * @deprecated Since hbase-2.0.0. No replacement. To be removed in 
hbase-3.0.0 and replaced
+   * with something that doesn't expose IntefaceAudience.Private classes.
    */
-  public boolean preWALWrite(final RegionInfo info, final WALKey logKey, final 
WALEdit logEdit)
+  @Deprecated
+  public void preWALWrite(final RegionInfo info, final WALKey logKey, final 
WALEdit logEdit)
       throws IOException {
-    return execOperationWithResult(false, coprocEnvironments.isEmpty() ? null :
-        new ObserverOperationWithResult<WALObserver, 
Boolean>(walObserverGetter) {
+    // Not bypassable.
+    if (this.coprocEnvironments.isEmpty()) {
+      return;
+    }
+    execOperation(new WALObserverOperation() {
       @Override
-      public Boolean call(WALObserver oserver) throws IOException {
-        return oserver.preWALWrite(this, info, logKey, logEdit);
+      public void call(WALObserver oserver) throws IOException {
+        oserver.preWALWrite(this, info, logKey, logEdit);
       }
     });
   }
-
   /**
-   * @param info
-   * @param logKey
-   * @param logEdit
-   * @throws IOException
+   * @deprecated Since hbase-2.0.0. No replacement. To be removed in 
hbase-3.0.0 and replaced
+   * with something that doesn't expose IntefaceAudience.Private classes.
    */
+  @Deprecated
   public void postWALWrite(final RegionInfo info, final WALKey logKey, final 
WALEdit logEdit)
       throws IOException {
     execOperation(coprocEnvironments.isEmpty() ? null : new 
WALObserverOperation() {

http://git-wip-us.apache.org/repos/asf/hbase/blob/16012f93/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java
index 849eb1c..7e43c9d 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java
@@ -1264,10 +1264,9 @@ public class AccessController implements 
MasterCoprocessor, RegionCoprocessor,
   }
 
   @Override
-  public boolean preSetSplitOrMergeEnabled(final 
ObserverContext<MasterCoprocessorEnvironment> ctx,
+  public void preSetSplitOrMergeEnabled(final 
ObserverContext<MasterCoprocessorEnvironment> ctx,
       final boolean newValue, final MasterSwitchType switchType) throws 
IOException {
     requirePermission(getActiveUser(ctx), "setSplitOrMergeEnabled", 
Action.ADMIN);
-    return false;
   }
 
   @Override
@@ -1282,10 +1281,9 @@ public class AccessController implements 
MasterCoprocessor, RegionCoprocessor,
   }
 
   @Override
-  public boolean 
preBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> c,
+  public void preBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> c,
       boolean newValue) throws IOException {
     requirePermission(getActiveUser(c), "balanceSwitch", Action.ADMIN);
-    return newValue;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/16012f93/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
index af69c87..790f6d5 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
@@ -295,12 +295,6 @@ public class VisibilityController implements 
MasterCoprocessor, RegionCoprocesso
   }
 
   @Override
-  public boolean preSetSplitOrMergeEnabled(final 
ObserverContext<MasterCoprocessorEnvironment> ctx,
-      final boolean newValue, final MasterSwitchType switchType) throws 
IOException {
-    return false;
-  }
-
-  @Override
   public void postSetSplitOrMergeEnabled(final 
ObserverContext<MasterCoprocessorEnvironment> ctx,
       final boolean newValue, final MasterSwitchType switchType) throws 
IOException {
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/16012f93/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java
index 2ad5f9a..14063df 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java
@@ -77,6 +77,5 @@ public class TestHRegionLocation {
     int compare2 = hsl2.compareTo(hsl1);
     assertTrue((compare1 > 0)? compare2 < 0: compare2 > 0);
   }
-
 }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/16012f93/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/SampleRegionWALCoprocessor.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/SampleRegionWALCoprocessor.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/SampleRegionWALCoprocessor.java
index 6dbd04f..9f58fc4 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/SampleRegionWALCoprocessor.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/SampleRegionWALCoprocessor.java
@@ -99,12 +99,11 @@ public class SampleRegionWALCoprocessor implements 
WALCoprocessor, RegionCoproce
   }
 
   @Override
-  public boolean preWALWrite(ObserverContext<? extends 
WALCoprocessorEnvironment> env,
+  public void preWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> 
env,
       RegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
-    boolean bypass = false;
     // check table name matches or not.
     if (!Bytes.equals(info.getTable().toBytes(), this.tableName)) {
-      return bypass;
+      return;
     }
     preWALWriteCalled = true;
     // here we're going to remove one keyvalue from the WALEdit, and add
@@ -134,7 +133,6 @@ public class SampleRegionWALCoprocessor implements 
WALCoprocessor, RegionCoproce
       LOG.debug("About to delete a KeyValue from WALEdit.");
       cells.remove(deletedCell);
     }
-    return bypass;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/16012f93/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
index e9a56bd..60b0260 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
@@ -90,7 +90,6 @@ public class TestMasterObserver {
 
   public static class CPMasterObserver implements MasterCoprocessor, 
MasterObserver {
 
-    private boolean bypass = false;
     private boolean preCreateTableCalled;
     private boolean postCreateTableCalled;
     private boolean preDeleteTableCalled;
@@ -182,10 +181,6 @@ public class TestMasterObserver {
     private boolean preLockHeartbeatCalled;
     private boolean postLockHeartbeatCalled;
 
-    public void enableBypass(boolean bypass) {
-      this.bypass = bypass;
-    }
-
     public void resetStates() {
       preCreateTableCalled = false;
       postCreateTableCalled = false;
@@ -301,9 +296,6 @@ public class TestMasterObserver {
     @Override
     public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> 
env,
         TableDescriptor desc, RegionInfo[] regions) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preCreateTableCalled = true;
     }
 
@@ -324,9 +316,6 @@ public class TestMasterObserver {
     @Override
     public void preDeleteTable(ObserverContext<MasterCoprocessorEnvironment> 
env,
         TableName tableName) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preDeleteTableCalled = true;
     }
 
@@ -347,9 +336,6 @@ public class TestMasterObserver {
     @Override
     public void preTruncateTable(ObserverContext<MasterCoprocessorEnvironment> 
env,
         TableName tableName) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preTruncateTableCalled = true;
     }
 
@@ -368,12 +354,6 @@ public class TestMasterObserver {
     }
 
     @Override
-    public boolean preSetSplitOrMergeEnabled(final 
ObserverContext<MasterCoprocessorEnvironment> ctx,
-        final boolean newValue, final MasterSwitchType switchType) throws 
IOException {
-      return false;
-    }
-
-    @Override
     public void postSetSplitOrMergeEnabled(final 
ObserverContext<MasterCoprocessorEnvironment> ctx,
         final boolean newValue, final MasterSwitchType switchType) throws 
IOException {
     }
@@ -381,9 +361,6 @@ public class TestMasterObserver {
     @Override
     public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> 
env,
         TableName tableName, TableDescriptor htd) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preModifyTableCalled = true;
     }
 
@@ -404,9 +381,6 @@ public class TestMasterObserver {
     @Override
     public void 
preCreateNamespace(ObserverContext<MasterCoprocessorEnvironment> env,
         NamespaceDescriptor ns) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preCreateNamespaceCalled = true;
     }
 
@@ -427,9 +401,6 @@ public class TestMasterObserver {
     @Override
     public void 
preDeleteNamespace(ObserverContext<MasterCoprocessorEnvironment> env,
         String name) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preDeleteNamespaceCalled = true;
     }
 
@@ -450,9 +421,6 @@ public class TestMasterObserver {
     @Override
     public void 
preModifyNamespace(ObserverContext<MasterCoprocessorEnvironment> env,
         NamespaceDescriptor ns) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preModifyNamespaceCalled = true;
     }
 
@@ -490,9 +458,6 @@ public class TestMasterObserver {
     @Override
     public void 
preListNamespaceDescriptors(ObserverContext<MasterCoprocessorEnvironment> env,
         List<NamespaceDescriptor> descriptors) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preListNamespaceDescriptorsCalled = true;
     }
 
@@ -513,9 +478,6 @@ public class TestMasterObserver {
     @Override
     public void preEnableTable(ObserverContext<MasterCoprocessorEnvironment> 
env,
         TableName tableName) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preEnableTableCalled = true;
     }
 
@@ -536,9 +498,6 @@ public class TestMasterObserver {
     @Override
     public void preDisableTable(ObserverContext<MasterCoprocessorEnvironment> 
env,
         TableName tableName) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preDisableTableCalled = true;
     }
 
@@ -619,9 +578,6 @@ public class TestMasterObserver {
     public void preMove(ObserverContext<MasterCoprocessorEnvironment> env,
         RegionInfo region, ServerName srcServer, ServerName destServer)
     throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preMoveCalled = true;
     }
 
@@ -643,9 +599,6 @@ public class TestMasterObserver {
     @Override
     public void preAssign(ObserverContext<MasterCoprocessorEnvironment> env,
         final RegionInfo regionInfo) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preAssignCalled = true;
     }
 
@@ -666,9 +619,6 @@ public class TestMasterObserver {
     @Override
     public void preUnassign(ObserverContext<MasterCoprocessorEnvironment> env,
         final RegionInfo regionInfo, final boolean force) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preUnassignCalled = true;
     }
 
@@ -709,9 +659,6 @@ public class TestMasterObserver {
     @Override
     public void preBalance(ObserverContext<MasterCoprocessorEnvironment> env)
         throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preBalanceCalled = true;
     }
 
@@ -730,13 +677,9 @@ public class TestMasterObserver {
     }
 
     @Override
-    public boolean 
preBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> env, boolean b)
+    public void preBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> 
env, boolean b)
         throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preBalanceSwitchCalled = true;
-      return b;
     }
 
     @Override
@@ -898,9 +841,6 @@ public class TestMasterObserver {
         final ObserverContext<MasterCoprocessorEnvironment> env,
         final TableDescriptor desc,
         final RegionInfo[] regions) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preCreateTableActionCalled = true;
     }
 
@@ -928,9 +868,6 @@ public class TestMasterObserver {
     public void preDeleteTableAction(
         final ObserverContext<MasterCoprocessorEnvironment> env, final 
TableName tableName)
         throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preDeleteTableActionCalled = true;
     }
 
@@ -954,9 +891,6 @@ public class TestMasterObserver {
     public void preTruncateTableAction(
         final ObserverContext<MasterCoprocessorEnvironment> env, final 
TableName tableName)
         throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preTruncateTableActionCalled = true;
     }
 
@@ -980,9 +914,6 @@ public class TestMasterObserver {
         final ObserverContext<MasterCoprocessorEnvironment> env,
         final TableName tableName,
         final TableDescriptor htd) throws IOException {
-      if (bypass) {
-        env.bypass();
-      }
       preModifyTableActionCalled = true;
     }
 
@@ -1005,9 +936,6 @@ public class TestMasterObserver {
     public void preEnableTableAction(
         final ObserverContext<MasterCoprocessorEnvironment> ctx, final 
TableName tableName)
         throws IOException {
-      if (bypass) {
-        ctx.bypass();
-      }
       preEnableTableActionCalled = true;
     }
 
@@ -1030,9 +958,6 @@ public class TestMasterObserver {
     public void preDisableTableAction(
         final ObserverContext<MasterCoprocessorEnvironment> ctx, final 
TableName tableName)
         throws IOException {
-      if (bypass) {
-        ctx.bypass();
-      }
       preDisableTableActionCalled = true;
     }
 
@@ -1357,7 +1282,6 @@ public class TestMasterObserver {
     HMaster master = cluster.getMaster();
     MasterCoprocessorHost host = master.getMasterCoprocessorHost();
     CPMasterObserver cp = host.findCoprocessor(CPMasterObserver.class);
-    cp.enableBypass(true);
     cp.resetStates();
     assertFalse("No table created yet", cp.wasCreateTableCalled());
 
@@ -1370,7 +1294,6 @@ public class TestMasterObserver {
       admin.createTable(htd, Arrays.copyOfRange(HBaseTestingUtility.KEYS,
         1, HBaseTestingUtility.KEYS.length));
 
-      // preCreateTable can't bypass default action.
       assertTrue("Test table should be created", cp.wasCreateTableCalled());
       tableCreationLatch.await();
       assertTrue("Table pre create handler called.", cp
@@ -1389,7 +1312,6 @@ public class TestMasterObserver {
       tableCreationLatch = new CountDownLatch(1);
       admin.disableTable(tableName);
       assertTrue(admin.isTableDisabled(tableName));
-      // preDisableTable can't bypass default action.
       assertTrue("Coprocessor should have been called on table disable",
         cp.wasDisableTableCalled());
       assertTrue("Disable table handler should be called.",
@@ -1399,7 +1321,6 @@ public class TestMasterObserver {
       assertFalse(cp.wasEnableTableCalled());
       admin.enableTable(tableName);
       assertTrue(admin.isTableEnabled(tableName));
-      // preEnableTable can't bypass default action.
       assertTrue("Coprocessor should have been called on table enable",
         cp.wasEnableTableCalled());
       assertTrue("Enable table handler should be called.",
@@ -1411,7 +1332,6 @@ public class TestMasterObserver {
       // modify table
       htd.setMaxFileSize(512 * 1024 * 1024);
       modifyTableSync(admin, tableName, htd);
-      // preModifyTable can't bypass default action.
       assertTrue("Test table should have been modified",
         cp.wasModifyTableCalled());
 
@@ -1424,14 +1344,12 @@ public class TestMasterObserver {
       deleteTable(admin, tableName);
       assertFalse("Test table should have been deleted",
         admin.tableExists(tableName));
-      // preDeleteTable can't bypass default action.
       assertTrue("Coprocessor should have been called on table delete",
         cp.wasDeleteTableCalled());
       assertTrue("Delete table handler should be called.",
         cp.wasDeleteTableActionCalled());
 
-      // turn off bypass, run the tests again
-      cp.enableBypass(false);
+      // When bypass was supported, we'd turn off bypass and rerun tests. 
Leaving rerun in place.
       cp.resetStates();
 
       admin.createTable(htd);
@@ -1555,10 +1473,6 @@ public class TestMasterObserver {
     MasterCoprocessorHost host = master.getMasterCoprocessorHost();
     CPMasterObserver cp = host.findCoprocessor(CPMasterObserver.class);
 
-    cp.enableBypass(false);
-    cp.resetStates();
-
-
     // create a table
     Admin admin = UTIL.getAdmin();
     admin.createNamespace(NamespaceDescriptor.create(testNamespace).build());
@@ -1567,75 +1481,8 @@ public class TestMasterObserver {
     assertNotNull(admin.getNamespaceDescriptor(testNamespace));
     assertTrue("Test namespace descriptor should have been called",
         cp.wasGetNamespaceDescriptorCalled());
-
-    // turn off bypass, run the tests again
-    cp.enableBypass(true);
-    cp.resetStates();
-
-    boolean expected = false;
-    try {
-      admin.modifyNamespace(NamespaceDescriptor.create(testNamespace).build());
-    } catch (BypassCoprocessorException ce) {
-      expected = true;
-    }
-    assertTrue(expected);
-    assertTrue("Test namespace should not have been modified",
-        cp.preModifyNamespaceCalledOnly());
-
-    assertNotNull(admin.getNamespaceDescriptor(testNamespace));
-    assertTrue("Test namespace descriptor should have been called",
-        cp.wasGetNamespaceDescriptorCalled());
-
-    expected = false;
-    try {
-      admin.deleteNamespace(testNamespace);
-    } catch (BypassCoprocessorException ce) {
-      expected = true;
-    }
-    assertTrue(expected);
-    assertTrue("Test namespace should not have been deleted", 
cp.preDeleteNamespaceCalledOnly());
-
-    assertNotNull(admin.getNamespaceDescriptor(testNamespace));
-    assertTrue("Test namespace descriptor should have been called",
-        cp.wasGetNamespaceDescriptorCalled());
-
-    cp.enableBypass(false);
-    cp.resetStates();
-
-    // delete table
-    admin.modifyNamespace(NamespaceDescriptor.create(testNamespace).build());
-    assertTrue("Test namespace should have been modified", 
cp.wasModifyNamespaceCalled());
-
-    admin.deleteNamespace(testNamespace);
-    assertTrue("Test namespace should have been deleted", 
cp.wasDeleteNamespaceCalled());
-
-    cp.enableBypass(true);
-    cp.resetStates();
-
-    expected = false;
-    try {
-      admin.createNamespace(NamespaceDescriptor.create(testNamespace).build());
-    } catch (BypassCoprocessorException ce) {
-      expected = true;
-    }
-    assertTrue(expected);
-    assertTrue("Test namespace should not be created", 
cp.preCreateNamespaceCalledOnly());
-
-    // turn on bypass, run the test
-    cp.enableBypass(true);
-    cp.resetStates();
-
-    admin.listNamespaceDescriptors();
-    assertTrue("post listNamespace should not have been called",
-               cp.preListNamespaceDescriptorsCalledOnly());
-
-    // turn off bypass, run the tests again
-    cp.enableBypass(false);
-    cp.resetStates();
-
-    admin.listNamespaceDescriptors();
-    assertTrue("post listNamespace should have been called",
-               cp.wasListNamespaceDescriptorsCalled());
+    // This test used to do a bunch w/ bypass but bypass of these table and 
namespace stuff has
+    // been removed so the testing code was removed.
   }
 
   private void modifyTableSync(Admin admin, TableName tableName, 
HTableDescriptor htd)
@@ -1659,7 +1506,6 @@ public class TestMasterObserver {
     HMaster master = cluster.getMaster();
     MasterCoprocessorHost host = master.getMasterCoprocessorHost();
     CPMasterObserver cp = host.findCoprocessor(CPMasterObserver.class);
-    cp.enableBypass(false);
     cp.resetStates();
 
     Table table = UTIL.createMultiRegionTable(tableName, TEST_FAMILY);

Reply via email to