@Override
  public void start(CoprocessorEnvironment ctx) throws IOException {
    this.conf = ctx.getConfiguration();
    this.quotasEnabled = QuotaUtil.isQuotaEnabled(conf);

    if (!(ctx instanceof MasterCoprocessorEnvironment)) {
      throw new CoprocessorException("Must be loaded on master.");
    }
    // if running on master
    MasterCoprocessorEnvironment mEnv = (MasterCoprocessorEnvironment) ctx;
    if (mEnv instanceof HasMasterServices) {
      this.masterServices = ((HasMasterServices) mEnv).getMasterServices();
    } else {
      throw new CoprocessorException("Must be loaded on a master having master services.");
    }
  }
An observer to automatically delete quotas when a table/namespace is deleted.
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/MasterQuotasObserver.java