/** * ADVANCED: * Return the unit of work cache isolation setting. * This setting configures how the session cache will be used in a unit of work. * @see #setUnitOfWorkCacheIsolationLevel(int) */ public int getUnitOfWorkCacheIsolationLevel() { return getCachePolicy().getUnitOfWorkCacheIsolationLevel(); }
/** * ADVANCED: * Return the unit of work cache isolation setting. * This setting configures how the session cache will be used in a unit of work. * @see #setUnitOfWorkCacheIsolationLevel(int) */ public int getUnitOfWorkCacheIsolationLevel() { return getCachePolicy().getUnitOfWorkCacheIsolationLevel(); }
/** * INTERNAL: * Initialize the cache isolation setting. * This may need to be called multiple times as notifyReferencingDescriptorsOfIsolation() can change the cache isolation. */ public void postInitialize(ClassDescriptor descriptor, AbstractSession session) throws DescriptorException { if (!isSharedIsolation()) { descriptor.notifyReferencingDescriptorsOfIsolation(session); } // PERF: If using isolated cache, then default uow isolation to always (avoids merge/double build). if ((getUnitOfWorkCacheIsolationLevel() == UNDEFINED_ISOLATATION) || this.wasDefaultUnitOfWorkCacheIsolationLevel) { this.wasDefaultUnitOfWorkCacheIsolationLevel = true; if (isIsolated()) { setUnitOfWorkCacheIsolationLevel(ISOLATE_CACHE_ALWAYS); } else if (isProtectedIsolation()) { setUnitOfWorkCacheIsolationLevel(ISOLATE_FROM_CLIENT_SESSION); } else { setUnitOfWorkCacheIsolationLevel(ISOLATE_NEW_DATA_AFTER_TRANSACTION); } } // Record that there is an isolated class in the project. if (!isSharedIsolation()) { session.getProject().setHasIsolatedClasses(true); } if (!shouldIsolateObjectsInUnitOfWork() && !descriptor.shouldBeReadOnly()) { session.getProject().setHasNonIsolatedUOWClasses(true); } }
/** * INTERNAL: * Initialize the cache isolation setting. * This may need to be called multiple times as notifyReferencingDescriptorsOfIsolation() can change the cache isolation. */ public void postInitialize(ClassDescriptor descriptor, AbstractSession session) throws DescriptorException { if (!isSharedIsolation()) { descriptor.notifyReferencingDescriptorsOfIsolation(session); } // PERF: If using isolated cache, then default uow isolation to always (avoids merge/double build). if ((getUnitOfWorkCacheIsolationLevel() == UNDEFINED_ISOLATATION) || this.wasDefaultUnitOfWorkCacheIsolationLevel) { this.wasDefaultUnitOfWorkCacheIsolationLevel = true; if (isIsolated()) { setUnitOfWorkCacheIsolationLevel(ISOLATE_CACHE_ALWAYS); } else if (isProtectedIsolation()) { setUnitOfWorkCacheIsolationLevel(ISOLATE_FROM_CLIENT_SESSION); } else { setUnitOfWorkCacheIsolationLevel(ISOLATE_NEW_DATA_AFTER_TRANSACTION); } } // Record that there is an isolated class in the project. if (!isSharedIsolation()) { session.getProject().setHasIsolatedClasses(true); } if (!shouldIsolateObjectsInUnitOfWork() && !descriptor.shouldBeReadOnly()) { session.getProject().setHasNonIsolatedUOWClasses(true); } }