for (CacheEntry<String, ?> entry : entries.converter(NullValueConverter.getInstance())) {
String sessionId = entry.getKey();
// If we are the new primary owner of this session
// then schedule expiration of this session locally
if (!oldLocality.isLocal(sessionId) && newLocality.isLocal(sessionId)) {
Batch batch = this.batcher.createBatch();
try {
// We need to lookup the session to obtain its meta data
V value = this.factory.findValue(sessionId);
if (value != null) {
ImmutableSession session = this.factory.createImmutableSession(sessionId, value);
this.scheduler.schedule(session);
}
} finally {
batch.discard();
}
}
}
}
}