/**
   * {@inheritDoc}
   *
   * @see
   *     com.continuent.tungsten.replicator.plugin.ReplicatorPlugin#release(com.continuent.tungsten.replicator.plugin.PluginContext)
   */
  public synchronized void release(PluginContext context)
      throws InterruptedException, ReplicatorException {
    // Cancel server.
    if (server != null) {
      try {
        server.stop();
      } catch (InterruptedException e) {
        logger.warn("Server stop operation was unexpectedly interrupted", e);
      } finally {
        server = null;
      }
    }

    if (catalog != null) {
      catalog.close();
      catalog = null;
    }
    if (diskLog != null) {
      diskLog.release();
      diskLog = null;
    }
  }