Exemplo n.º 1
0
  @SuppressWarnings("unchecked")
  public static final StatisticsRunnerInterface getInstance(
      String storePath, Map parameters, String storeClass) {
    if (instance != null) {
      return instance;
    } else {
      synchronized (semaphore) {
        if (instance == null) {
          logger.info(
              "Getting statistics runner interface with storePath: {} and parameters: {}",
              storeClass,
              parameters);
          try {
            instance = getStatisticsRunnerInstanceOSGi(storePath, parameters, storeClass);
            if (instance != null) {
              logger.info("Acquiring statistics runner from OSGi services succeeded");
              return instance;
            }
            logger.info("Falling back to old school mode.");
            instance = getStatisticsRunnerInstance(storePath, parameters, storeClass);
          } catch (Exception e) {
            AuditLog.log("INIT", "WARNING: StatisticsRunnner not available", e, Level.WARNING);
            instance = new DummyStatisticsRunner();
          }
        }

        return instance;
      }
    }
  }
Exemplo n.º 2
0
  @Override
  @SuppressWarnings("rawtypes")
  public void processMessage() {

    AuditLog.log(
        AuditLog.AUDIT_MESSAGE_TRIBEMANAGER,
        "MembershipSmokeSignal: PROCESS MESSAGE (" + getKey() + "/" + getValue() + ")");

    if (getKey().equals(INTRODUCTION)) {
      TribeMemberInterface tm = (TribeMemberInterface) getValue();
      TribeManagerFactory.getInstance().addTribeMember(tm);

      /**
       * The Chief is responsible to sharing the active 'tribal maps' by sending an
       * IntroductionRequest to the new member.
       */
      if (TribeManagerFactory.getInstance().getIsChief()) {
        Collection<SharedTribalMap> c = SharedTribalMap.getAllTribalMaps();
        Iterator<SharedTribalMap> iter = c.iterator();
        while (iter.hasNext()) {
          IntroductionRequest ir = new IntroductionRequest(iter.next());
          TribeManagerFactory.getInstance().askSomebody(ir, tm.getAddress());
        }
      }
    }
  }
Exemplo n.º 3
0
  public static final WebserviceListenerRegistryInterface getInstance() {

    if (instance != null) {
      return instance;
    } else {

      synchronized (semaphore) {
        if (instance == null) {
          try {
            Class c = Class.forName("com.dexels.navajo.scheduler.WebserviceListenerRegistry");
            WebserviceListenerRegistryInterface dummy =
                (WebserviceListenerRegistryInterface) c.newInstance();
            Method m = c.getMethod("getInstance", (Class[]) null);
            instance = (WebserviceListenerRegistryInterface) m.invoke(dummy, (Object[]) null);
          } catch (Exception e) {
            AuditLog.log("INIT", "WARNING: WebserviceListener not available", Level.WARNING);
            instance = new DummyWebserviceListener();
          }
        }

        return instance;
      }
    }
  }