/** Returns the number of milliseconds until this task should expire. The return value will never be negative. */ final long getExpiryMillis() throws EntryNotFoundException { long extm = getExpirationTime() - getNow(); if (extm < 0L) return 0L; else return extm; }
/** * Return true if current task could have expired. * Return false if expiration is impossible. */ protected boolean isExpirationPossible() throws EntryNotFoundException { long expTime = getExpirationTime(); if (expTime > 0L && getNow() >= expTime) { return true; } return false; }
/** * Return true if current task could have expired. * Return false if expiration is impossible. */ protected boolean isExpirationPossible() throws EntryNotFoundException { long expTime = getExpirationTime(); if (expTime > 0L && getNow() >= expTime) { return true; } return false; }
/** Returns the number of milliseconds until this task should expire. The return value will never be negative. */ final long getExpiryMillis() throws EntryNotFoundException { long extm = getExpirationTime() - getNow(); if (extm < 0L) return 0L; else return extm; }
protected void performTimeout() throws CacheException { if (logger.isDebugEnabled()) { logger.debug("{}.performTimeout(): getExpirationTime() returns {}", this.toString(), getExpirationTime()); } getLocalRegion().performExpiryTimeout(this); }
/** schedules the given expiration task */ public ExpiryTask addExpiryTask(ExpiryTask task) { LogWriterI18n log = task.getLocalRegion().getCache().getLoggerI18n(); try { if (DEBUG) { log.info(LocalizedStrings.ExpirationScheduler_SCHEDULING__0__TO_FIRE_IN__1__MS, new Object[] {task, Long.valueOf(task.getExpiryMillis())}); } // By using getExpirationTime and passing a Date to schedule // we get rid of two calls of System.currentTimeMillis(). // The Date object creation is very simple and has a very short life. timer.schedule(task, new Date(task.getExpirationTime())); } catch (EntryNotFoundException e) { // ignore - there are unsynchronized paths that allow an entry to // be destroyed out from under us. } catch (IllegalStateException e) { // task must have been cancelled by another thread so don't schedule it } return task; }
protected void performTimeout() throws CacheException { if (getLoggerI18n().fineEnabled()) { getLoggerI18n().fine(this.toString() + ".performTimeout(): getExpirationTime() returns " + getExpirationTime()); } getLocalRegion().performExpiryTimeout(this); }