Ejemplo 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);
      }
    }
Ejemplo n.º 2
0
    public void run() {
      __log.debug("Starting process definition reaper thread.");
      long pollingTime = 10000;
      try {
        while (true) {
          Thread.sleep(pollingTime);
          if (!_mngmtLock.writeLock().tryLock(100L, TimeUnit.MILLISECONDS)) continue;
          try {
            __log.debug("Kicking reaper, OProcess instances: " + OProcess.instanceCount);
            // Copying the runnning process list to avoid synchronization
            // problems and a potential mess if a policy modifies the list
            List<BpelProcess> candidates = new ArrayList<BpelProcess>(_registeredProcesses);
            CollectionsX.remove_if(
                candidates,
                new MemberOfFunction<BpelProcess>() {
                  public boolean isMember(BpelProcess o) {
                    return !o.hintIsHydrated();
                  }
                });

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