ExpressionBuilder builder = selectionCriteria.getBuilder();
if (builder.getSession() == null) {
builder.setSession(this.session.getRootSession(null));
builder.setQueryClass(theClass);
}
CacheInvalidationPolicy cacheInvalidationPolicy = descriptor.getCacheInvalidationPolicy();
int inMemoryQueryIndirectionPolicy = InMemoryQueryIndirectionPolicy.SHOULD_IGNORE_EXCEPTION_RETURN_NOT_CONFORMED;
if (shouldInvalidateOnException) {
inMemoryQueryIndirectionPolicy = InMemoryQueryIndirectionPolicy.SHOULD_IGNORE_EXCEPTION_RETURN_CONFORMED;
}
// cache the current time to avoid calculating it every time through the loop
long currentTimeInMillis = System.currentTimeMillis();
//Enumeration doesn't checkReadLocks
for (Enumeration cacheEnum = map.keys(false); cacheEnum.hasMoreElements();) {
CacheKey key = (CacheKey)cacheEnum.nextElement();
Object object = key.getObject();
if (object == null || cacheInvalidationPolicy.isInvalidated(key, currentTimeInMillis)) {
continue;
}
// Must check for inheritance.
if (!isChildDescriptor || (object.getClass() == theClass) || (theClass.isInstance(object))) {