Пример #1
0
  public void runIt(Object td[]) {
    long timeNow = System.currentTimeMillis();
    if (dL > 2) debug("Checking " + timeNow);
    int checkedCount;
    synchronized (managedObjs) {
      checkedCount = managedCount;
      if (checkedObjs.length < checkedCount) checkedObjs = new TimeStamp[managedLen];
      System.arraycopy(managedObjs, 0, checkedObjs, 0, checkedCount);
    }
    for (int i = 0; i < checkedCount; i++) {
      TimeStamp ts = checkedObjs[i];
      checkedObjs[i] = null;

      if (ts == null || !ts.isValid()) continue;

      long maxInactiveInterval = ts.getMaxInactiveInterval();
      if (dL > 3) debug("TS: " + maxInactiveInterval + " " + ts.getLastAccessedTime());
      if (maxInactiveInterval < 0) continue;

      long timeIdle = timeNow - ts.getLastAccessedTime();

      if (timeIdle >= maxInactiveInterval) {
        if (expireCallback != null) {
          if (dL > 0) debug(ts + " " + timeIdle + " " + maxInactiveInterval);
          expireCallback.expired(ts);
        }
      }
    }
  }