code: public static Templates getTemplates(File src) throws TransformerException {
          String key = src.getAbsolutePath();
          TimestampedCacheEntry<Templates> entry = TEMPLATES_CACHE.get(key);
          // check to see if it is null or has changed
          if (entry == null || entry.timestamp() < src.lastModified()) {
              TransformerFactory factory = null;
              try {
                  factory = borrowTransformerFactory();
                  Templates template = factory.newTemplates(new StreamSource(src));
                  entry = new TimestampedCacheEntry<Templates>(src.lastModified(), template);
              } catch (Exception e) {
                  throw new TransformerException(e.getMessage(), e);
              } finally {
                  if (factory != null) returnTransformerFactory(factory);
              }
              TEMPLATES_CACHE.put(key, entry);
          }
          return entry.value();
      }
docs: Try to cache parsed Templates, but check for changes on disk
  @param src
  @return Templates