Exemplo n.º 1
0
  @Override
  @SuppressWarnings("unchecked")
  public void postLoad(Class<?>[] classes) {
    for (Class<?> clazz : classes) {
      if (log.isDebugEnabled()) {
        log.debug("Loading class " + clazz.getName());
      }

      if (!isValidClass(clazz)) {
        continue;
      }

      if (ClassUtils.isSubclass(clazz, Language.class)) {
        Class<? extends Language> language = (Class<? extends Language>) clazz;
        if (language != null) {
          try {
            handler.registerLanguage(language.newInstance());
          } catch (Exception e) {
            log.error("Registering " + language.getName(), e);
          }
        }
      }
    }

    super.postLoad(classes);

    log.info("Loaded " + handler.size() + " custom message handlers.");
  }
Exemplo n.º 2
0
  @Override
  public void preUnload(Class<?>[] classes) {
    if (log.isDebugEnabled()) {
      for (Class<?> clazz : classes) {
        log.debug("Unload language " + clazz.getName());
      }
    }

    super.preUnload(classes);

    handler.clear();
  }