public boolean registerService(Service instance) {
    // No stacking of instances is allowed for a single service name
    ServiceDescriptor serviceDesc = instance.getDescriptorForType();
    String serviceName = CoprocessorRpcUtils.getServiceName(serviceDesc);
    if (coprocessorServiceHandlers.containsKey(serviceName)) {
      LOG.error("Coprocessor service {} already registered, rejecting request from {} in region {}",
        serviceName, instance, this);
      return false;
    }

    coprocessorServiceHandlers.put(serviceName, instance);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Registered coprocessor service: region="
        + Bytes.toStringBinary(getRegionInfo().getRegionName()) + " service=" + serviceName);
    }
    return true;
  }
Registers a new protocol buffer {@link Service} subclass as a coprocessor endpoint to be
available for handling {@link #execService(RpcController, CoprocessorServiceCall)} calls.
<p/>
Only a single instance may be registered per region for a given {@link Service} subclass (the
instances are keyed on {@link ServiceDescriptor#getFullName()}.. After the first registration,
subsequent calls with the same service name will fail with a return value of {@code false}.
@param instance the {@code Service} subclass instance to expose as a coprocessor endpoint
@return {@code true} if the registration was successful, {@code false} otherwise
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java