anchor.diff:  }
   ----
   
  +. Load the Coprocessor.
  +
  +. Write a client code to call the Coprocessor.
  +
  +
  +== Guidelines For Deploying A Coprocessor
  +
  +Bundling Coprocessors::
  +  You can bundle all classes for a coprocessor into a
  +  single JAR on the RegionServer's classpath, for easy deployment. Otherwise,
  +  place all dependencies  on the RegionServer's classpath so that they can be
  +  loaded during RegionServer start-up.  The classpath for a RegionServer is set
  +  in the RegionServer's `hbase-env.sh` file.
  +Automating Deployment::
  +  You can use a tool such as Puppet, Chef, or
  +  Ansible to ship the JAR for the coprocessor  to the required location on your
  +  RegionServers' filesystems and restart each RegionServer,  to automate
  +  coprocessor deployment. Details for such set-ups are out of scope of  this
  +  document.
  +Updating a Coprocessor::
  +  Deploying a new version of a given coprocessor is not as simple as disabling it,
  +  replacing the JAR, and re-enabling the coprocessor. This is because you cannot
  +  reload a class in a JVM unless you delete all the current references to it.
  +  Since the current JVM has reference to the existing coprocessor, you must restart
  +  the JVM, by restarting the RegionServer, in order to replace it. This behavior
  +  is not expected to change.
  +Coprocessor Logging::
  +  The Coprocessor framework does not provide an API for logging beyond standard Java
  +  logging.
  +Coprocessor Configuration::
  +  If you do not want to load coprocessors from the HBase Shell, you can add their configuration
  +  properties to `hbase-site.xml`. In <<load_coprocessor_in_shell>>, two arguments are
  +  set: `arg1=1,arg2=2`. These could have been added to `hbase-site.xml` as follows:
  +[source,xml]
  +----
  +<property>
  +  <name>arg1</name>
  +  <value>1</value>
  +</property>
  +<property>
  +  <name>arg2</name>
  +  <value>2</value>
  +</property>
  +----
  +Then you can read the configuration using code like the following:
  +[source,java]
  +----
  +Configuration conf = HBaseConfiguration.create();
  +// Use below code for HBase version 1.x.x or above.
  +Connection connection = ConnectionFactory.createConnection(conf);
  +TableName tableName = TableName.valueOf("users");
  +Table table = connection.getTable(tableName);
  +
  +//Use below code HBase version 0.98.xx or below.
  +//HConnection connection = HConnectionManager.createConnection(conf);
  +//HTableInterface table = connection.getTable("users");
  +
  +Get get = new Get(Bytes.toBytes("admin"));
  +Result result = table.get(get);
  +for (Cell c : result.rawCells()) {
  +    System.out.println(Bytes.toString(CellUtil.cloneRow(c))
  +        + "==> " + Bytes.toString(CellUtil.cloneFamily(c))
  +        + "{" + Bytes.toString(CellUtil.cloneQualifier(c))
  +        + ":" + Bytes.toLong(CellUtil.cloneValue(c)) + "}");
  +}
  +Scan scan = new Scan();
  +ResultScanner scanner = table.getScanner(scan);
  +for (Result res : scanner) {
  +    for (Cell c : res.rawCells()) {
  +        System.out.println(Bytes.toString(CellUtil.cloneRow(c))
  +        + " ==> " + Bytes.toString(CellUtil.cloneFamily(c))
  +        + " {" + Bytes.toString(CellUtil.cloneQualifier(c))
  +        + ":" + Bytes.toLong(CellUtil.cloneValue(c))
  +        + "}");
  +    }
  +}
  +----
  +
  +
  +
   
   == Monitor Time Spent in Coprocessors
   
  
positive.code: admin.modifyTable(tableName, hTableDescriptor);
  admin.enableTable(tableName);
  ----
  +
  Optionally you can also use removeCoprocessor() method of HTableDescriptor class.
  
  
  
  [[cp_example]]
  == Examples
  HBase ships Coprocessor examples for Observer Coprocessor see
  // Below URL is more than 100 characters long.
  link:http://hbase.apache.org/xref/org/apache/hadoop/hbase/coprocessor/example/ZooKeeperScanPolicyObserver.html[ZooKeeperScanPolicyObserver]
  and for Endpoint Coprocessor see
  // Below URL is more than 100 characters long.
  link:http://hbase.apache.org/xref/org/apache/hadoop/hbase/coprocessor/example/RowCountEndpoint.html[RowCountEndpoint]
  
  A more detailed example is given below.
  
  For the sake of example let's take an hypothetical case. Suppose there is a HBase table called
  'users'. The table has two column families 'personalDet' and 'salaryDet' containing personal
  details and salary details respectively. Below is the graphical representation of the 'users'
  table.
  
  .Users Table
  [width="100%",cols="7",options="header,footer"]
  
negative.code: |====================
  
  
  === Observer Example
  
  The following Observer coprocessor prevents the details of the user `admin` from being
  returned in a `Get` or `Scan` of the `users` table.
  
  . Write a class that extends the
  link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/BaseRegionObserver.html[BaseRegionObserver]
  class.
  
  . Override the `preGetOp()` method (the `preGet()` method is deprecated) to check
  whether the client has queried for the rowkey with value `admin`. If so, return an
  empty result. Otherwise, process the request as normal.
  
  . Put your code and dependencies in a JAR file.
  
  . Place the JAR in HDFS where HBase can locate it.
  
  . Load the Coprocessor.
  
  