/** * Returns false if the region reliability state does not allow this expiry * task to fire. */ protected boolean isExpirationAllowed() { return getLocalRegion().isExpirationAllowed(this); }
/** * Returns false if the region reliability state does not allow this expiry * task to fire. */ protected boolean isExpirationAllowed() { return getLocalRegion().isExpirationAllowed(this); }
/** * Cancel this task */ @Override public boolean cancel() { boolean superCancel = super.cancel(); LocalRegion lr = getLocalRegion(); if (lr != null) { if (superCancel) { this.region = null; // this is the only place it is nulled } } return superCancel; }
/** Return the absolute time when TTL expiration occurs, or 0 if not used */ public final long getTTLExpirationTime() throws EntryNotFoundException { long ttl = getTTLAttributes().getTimeout(); long tilt = 0; if (ttl > 0) { if (getLocalRegion()!=null && !getLocalRegion().EXPIRY_UNITS_MS) { ttl *= 1000; } tilt = getLastModifiedTime() + ttl; } return tilt; }
/** Return the absolute time when idle expiration occurs, or 0 if not used */ public final long getIdleExpirationTime() throws EntryNotFoundException { long idle = getIdleAttributes().getTimeout(); long tilt = 0; if (idle > 0) { if (getLocalRegion()!=null && !getLocalRegion().EXPIRY_UNITS_MS) { idle *= 1000; } tilt = getLastAccessedTime() + idle; } return tilt; }
protected void performTimeout() throws CacheException { if (logger.isDebugEnabled()) { logger.debug("{}.performTimeout(): getExpirationTime() returns {}", this.toString(), getExpirationTime()); } getLocalRegion().performExpiryTimeout(this); }
@Override public LogWriterI18n getLoggerI18n() { return getLocalRegion().getCache().getLoggerI18n(); }
protected boolean isCacheClosing() { return ((GemFireCacheImpl) getLocalRegion().getCache()).isClosed(); }
protected boolean isCacheClosing() { return ((GemFireCacheImpl) getLocalRegion().getCache()).isClosed(); }
/** * Cancel this task */ @Override public boolean cancel() { boolean superCancel = super.cancel(); LocalRegion lr = getLocalRegion(); if (lr != null) { lr.cancelPendingExpiry(this); // always call or only if superCancel? if (superCancel) { this.region = null; // this is the only place it is nulled } } return superCancel; }
/** * Wait until permission is given for expiration to be done. * Tests are allowed to suspend expiration. * @since 5.0 */ private final void waitOnExpirationSuspension() { for (;;) { getLocalRegion().getCancelCriterion().checkCancelInProgress(null); synchronized (suspendLock) { boolean interrupted = Thread.interrupted(); try { while (expirationSuspended) { suspendLock.wait(); } break; } catch (InterruptedException ex) { interrupted = true; getLocalRegion().getCancelCriterion().checkCancelInProgress(null); // keep going, we can't cancel } finally { if (interrupted) { Thread.currentThread().interrupt(); } } } // synchronized } // for }
/** * Wait until permission is given for expiration to be done. * Tests are allowed to suspend expiration. * @since 5.0 */ private final void waitOnExpirationSuspension() { for (;;) { getLocalRegion().getCancelCriterion().checkCancelInProgress(null); synchronized (suspendLock) { boolean interrupted = Thread.interrupted(); try { while (expirationSuspended) { suspendLock.wait(); } break; } catch (InterruptedException ex) { interrupted = true; getLocalRegion().getCancelCriterion().checkCancelInProgress(null); // keep going, we can't cancel } finally { if (interrupted) { Thread.currentThread().interrupt(); } } } // synchronized } // for }
/** Return the absolute time when idle expiration occurs, or 0 if not used */ protected final long getIdleExpirationTime() throws EntryNotFoundException { long idle = getIdleAttributes().getTimeout(); long tilt = 0; if (idle > 0) { if (!getLocalRegion().EXPIRY_UNITS_MS) { idle *= 1000; } tilt = getLastAccessedTime() + idle; } return tilt; }
/** Return the absolute time when TTL expiration occurs, or 0 if not used */ protected final long getTTLExpirationTime() throws EntryNotFoundException { long ttl = getTTLAttributes().getTimeout(); long tilt = 0; if (ttl > 0) { if (!getLocalRegion().EXPIRY_UNITS_MS) { ttl *= 1000; } tilt = getLastModifiedTime() + ttl; } return tilt; }
return super.toString() + " for " + getLocalRegion() + ", ttl expiration time: " + expTtl + ", idle expiration time: " + expIdle +
/** 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; }
return super.toString() + " for " + getLocalRegion() + ", ttl expiration time: " + expTtl + ", idle expiration time: " + expIdle +
protected void performTimeout() throws CacheException { if (getLoggerI18n().fineEnabled()) { getLoggerI18n().fine(this.toString() + ".performTimeout(): getExpirationTime() returns " + getExpirationTime()); } getLocalRegion().performExpiryTimeout(this); }
protected void runInThreadPool() { try { if (isCacheClosing() || getLocalRegion().isClosed() || getLocalRegion().isDestroyed()) { return;
protected void runInThreadPool() { try { if (isCacheClosing() || getLocalRegion().isClosed() || getLocalRegion().isDestroyed()) { return;