@Override
    public void run() {
      LOG.info("Wait interval is {}", waitInterval);
      if (waitInterval > 0) {
        try {
          LOG.info("Cleaner Thread Restarted and {} or {} is configured. So cleaner thread will startup post waiting "
                  + "{} ms", EVENT_DB_LISTENER_CLEAN_STARTUP_WAIT_INTERVAL,
              EVENT_DB_LISTENER_CLEAN_STARTUP_WAIT_INTERVAL.getHiveName(), waitInterval);
          Thread.sleep(waitInterval);
        } catch (InterruptedException e) {
          LOG.error("Failed during the initial wait before start.", e);
          if(isInTest) {
            Thread.currentThread().interrupt();
          }
          return;
        }
        LOG.info("Completed Cleaner thread initial wait. Starting normal processing.");
      }

      while (true) {
        LOG.debug("Cleaner thread running");
        try {
          rs.cleanNotificationEvents(ttl);
          rs.cleanWriteNotificationEvents(ttl);
        } catch (Exception ex) {
          LOG.warn("Exception received while cleaning notifications", ex);
        }
        LOG.debug("Cleaner thread done");

        try {
          LOG.debug("Sleeping {}ms", sleepTime);
          Thread.sleep(sleepTime);
        } catch (InterruptedException e) {
          LOG.info("Cleaner thread interrupted. Exiting.");
          return;
        }
      }
    }
Process this notification by adding it to metastore DB.

@param event NotificationEvent is the object written to the metastore DB.
@param listenerEvent ListenerEvent (from which NotificationEvent was based) used only to set the
                     DB_NOTIFICATION_EVENT_ID_KEY_NAME for future reference by other listeners.
hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java