Exemplo n.º 1
0
    public void run() {
      __log.debug("Starting process definition reaper thread.");
      long pollingTime = 10000;
      try {
        while (true) {
          Thread.sleep(pollingTime);
          // Copying the runnning process list to avoid synchronizatMessageExchangeInterion
          // problems and a potential mess if a policy modifies the list
          List<ODEProcess> candidates = new ArrayList<ODEProcess>(_registeredProcesses.values());
          CollectionsX.remove_if(
              candidates,
              new MemberOfFunction<ODEProcess>() {
                public boolean isMember(ODEProcess o) {
                  return !o.hintIsHydrated();
                }
              });

          // And the happy winners are...
          List<ODEProcess> ripped = _dehydrationPolicy.markForDehydration(candidates);
          // Bye bye
          for (ODEProcess process : ripped) {
            __log.debug("Dehydrating process " + process.getPID());
            process.dehydrate();
          }
        }
      } catch (InterruptedException e) {
        __log.info(e);
      }
    }