code: public void destroy() {
          try {
              ctx.close();
          }
          catch (javax.naming.NamingException e) {
              LOG.warn("Error when closing", e);
          }
      }
docs: Destroy method that allows the target DirContext to be cleaned up when
  the SingleContextSource is not going to be used any more.