use of org.infinispan.notifications.cachelistener.annotation.CacheEntryExpired in project indy by Commonjava.
the class ScheduleManager method expired.
@CacheEntryExpired
public void expired(CacheEntryExpiredEvent<ScheduleKey, Map> e) {
final ScheduleKey expiredKey = e.getKey();
final Map expiredContent = e.getValue();
if (expiredKey != null && expiredContent != null) {
logger.debug("EXPIRED: {}", expiredKey);
final String type = (String) expiredContent.get(ScheduleManager.JOB_TYPE);
final String data = (String) expiredContent.get(ScheduleManager.PAYLOAD);
eventDispatcher.fire(new SchedulerTriggerEvent(type, data));
}
}
use of org.infinispan.notifications.cachelistener.annotation.CacheEntryExpired in project indy by Commonjava.
the class DefaultScheduleManager method expired.
@CacheEntryExpired
public void expired(CacheEntryExpiredEvent<ScheduleKey, ScheduleValue> e) {
if (e == null) {
logger.error("[FATAL]The infinispan cache expired event for indy schedule manager is null.", new NullPointerException("CacheEntryExpiredEvent is null"));
return;
}
if (!e.isPre()) {
final ScheduleKey expiredKey = e.getKey();
final ScheduleValue value = e.getValue();
if (value == null) {
logger.warn("The cache value for ISPN expired event of schedule expiration is null, key is {} .", expiredKey);
return;
}
final Map<String, Object> expiredContent = value.getDataPayload();
if (expiredKey != null && expiredContent != null) {
logger.debug("EXPIRED: {}", expiredKey);
final String type = (String) expiredContent.get(DefaultScheduleManager.JOB_TYPE);
final String data = (String) expiredContent.get(DefaultScheduleManager.PAYLOAD);
if (logger.isInfoEnabled() && DefaultScheduleManager.CONTENT_JOB_TYPE.equals(type)) {
ContentExpiration expiration;
try {
expiration = objectMapper.readValue(data, ContentExpiration.class);
final StoreKey key = expiration.getKey();
final String path = expiration.getPath();
logger.info("Expiring: {} in: {} at: {}.", path, key, new Date(System.currentTimeMillis()));
} catch (final IOException ioe) {
// ignore
}
}
fireEvent(eventDispatcher, new SchedulerTriggerEvent(type, data));
/*
scheduleEventLockCache.executeCache( cache -> cache.put( expiredKey, nodeHolder.getLocalIndyNode(),
schedulerConfig.getClusterLockExpiration(),
TimeUnit.SECONDS ) );
*/
}
}
}
use of org.infinispan.notifications.cachelistener.annotation.CacheEntryExpired in project indy by Commonjava.
the class FoloExpirationWarningListener method onCacheEntryExpired.
@CacheEntryExpired
public void onCacheEntryExpired(final CacheEntryExpiredEvent<TrackedContentEntry, TrackedContentEntry> event) {
if (event.isPre()) {
return;
}
TrackedContentEntry entry = event.getKey();
logger.warn("Tracking record entry {}:{}:{} was expired by Infinispan!", entry.getTrackingKey(), entry.getStoreKey(), entry.getPath());
}
Aggregations