Examples of CacheInvalidationPolicy


Examples of org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy

     * Check if the object is invalid and refresh it.
     * This is used to ensure that no invalid objects are registered.
     */
    public void checkInvalidObject(Object object, CacheKey cacheKey, ClassDescriptor descriptor) {
        if (!isNestedUnitOfWork() && (cacheKey.getObject() != null)) {
            CacheInvalidationPolicy cachePolicy = descriptor.getCacheInvalidationPolicy();
            // BUG#6671556 refresh invalid objects when accessed in the unit of work.
            if (cachePolicy.shouldRefreshInvalidObjectsInUnitOfWork() && cachePolicy.isInvalidated(cacheKey)) {
                ReadObjectQuery query = new ReadObjectQuery();
                query.setReferenceClass(object.getClass());
                query.setSelectionKey(cacheKey.getKey());
                query.refreshIdentityMapResult();
                query.setIsExecutionClone(true);
View Full Code Here

Examples of org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy

     * Check if the object is invalid and should be refreshed, return true, otherwise return false.
     * This is used to ensure that no invalid objects are registered.
     */
    public boolean checkInvalidObject(Object object, CacheKey cacheKey, ClassDescriptor descriptor, UnitOfWorkImpl unitOfWork) {
        if (!unitOfWork.isNestedUnitOfWork() && (cacheKey.getObject() != null)) {
            CacheInvalidationPolicy cachePolicy = descriptor.getCacheInvalidationPolicy();
            // BUG#6671556 refresh invalid objects when accessed in the unit of work.
            return (cachePolicy.shouldRefreshInvalidObjectsInUnitOfWork() && cachePolicy.isInvalidated(cacheKey));
        }
        return false;
    }
View Full Code Here

Examples of org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy

     * Check if the object is invalid and refresh it.
     * This is used to ensure that no invalid objects are registered.
     */
    public void checkInvalidObject(Object object, CacheKey cacheKey, ClassDescriptor descriptor) {
        if (!this.isNestedUnitOfWork && (cacheKey.getObject() != null)) {
            CacheInvalidationPolicy cachePolicy = descriptor.getCacheInvalidationPolicy();
            // BUG#6671556 refresh invalid objects when accessed in the unit of work.
            if (cachePolicy.shouldRefreshInvalidObjectsInUnitOfWork() && cachePolicy.isInvalidated(cacheKey)) {
                ReadObjectQuery query = new ReadObjectQuery();
                query.setReferenceClass(object.getClass());
                query.setSelectionId(cacheKey.getKey());
                query.refreshIdentityMapResult();
                query.setIsExecutionClone(true);
View Full Code Here

Examples of org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy

                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))) {
View Full Code Here

Examples of org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy

         * Check if the object is invalid and *should* be refreshed.
         * This is used to ensure that no invalid objects are cloned.
         */
        public boolean isConsideredInvalid(Object object, CacheKey cacheKey, ClassDescriptor descriptor) {
            if (cacheKey.getObject() != null) {
                CacheInvalidationPolicy cachePolicy = descriptor.getCacheInvalidationPolicy();
                // BUG#6671556 refresh invalid objects when accessed in the unit of work.
                return (cachePolicy.shouldRefreshInvalidObjectsOnClone() && cachePolicy.isInvalidated(cacheKey));
            }
            return false;
        }
View Full Code Here

Examples of org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy

     * Check if the object is invalid and refresh it.
     * This is used to ensure that no invalid objects are registered.
     */
    public void checkInvalidObject(Object object, CacheKey cacheKey, ClassDescriptor descriptor) {
        if (!this.isNestedUnitOfWork && (cacheKey.getObject() != null)) {
            CacheInvalidationPolicy cachePolicy = descriptor.getCacheInvalidationPolicy();
            // BUG#6671556 refresh invalid objects when accessed in the unit of work.
            if (cachePolicy.shouldRefreshInvalidObjectsInUnitOfWork() && cachePolicy.isInvalidated(cacheKey)) {
                ReadObjectQuery query = new ReadObjectQuery();
                query.setReferenceClass(object.getClass());
                query.setSelectionId(cacheKey.getKey());
                query.refreshIdentityMapResult();
                query.setIsExecutionClone(true);
View Full Code Here

Examples of org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy

     * Check if the object is invalid and refresh it.
     * This is used to ensure that no invalid objects are registered.
     */
    public void checkInvalidObject(Object object, CacheKey cacheKey, ClassDescriptor descriptor) {
        if (!isNestedUnitOfWork() && (cacheKey.getObject() != null)) {
            CacheInvalidationPolicy cachePolicy = descriptor.getCacheInvalidationPolicy();
            // BUG#6671556 refresh invalid objects when accessed in the unit of work.
            if (cachePolicy.shouldRefreshInvalidObjectsInUnitOfWork() && cachePolicy.isInvalidated(cacheKey)) {
                ReadObjectQuery query = new ReadObjectQuery();
                query.setReferenceClass(object.getClass());
                query.setSelectionKey(cacheKey.getKey());
                query.refreshIdentityMapResult();
                query.setIsExecutionClone(true);
View Full Code Here

Examples of org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy

                ExpressionBuilder builder = selectionCriteria.getBuilder();
                if (builder.getSession() == null) {
                    builder.setSession(getSession().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))) {
View Full Code Here

Examples of org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy

     * Check if the object is invalid and should be refreshed, return true, otherwise return false.
     * This is used to ensure that no invalid objects are registered.
     */
    public boolean checkInvalidObject(Object object, CacheKey cacheKey, ClassDescriptor descriptor, UnitOfWorkImpl unitOfWork) {
        if (!unitOfWork.isNestedUnitOfWork() && (cacheKey.getObject() != null)) {
            CacheInvalidationPolicy cachePolicy = descriptor.getCacheInvalidationPolicy();
            // BUG#6671556 refresh invalid objects when accessed in the unit of work.
            return (cachePolicy.shouldRefreshInvalidObjectsInUnitOfWork() && cachePolicy.isInvalidated(cacheKey));
        }
        return false;
    }
View Full Code Here

Examples of org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy

    /**
     * INTERNAL:
     * Potentially override the cache invalidation behavior
     */
    protected void initializeCacheInvalidationPolicy() {
        CacheInvalidationPolicy parentPolicyClone = (CacheInvalidationPolicy)getParentDescriptor().getCacheInvalidationPolicy().clone();
        getDescriptor().setCacheInvalidationPolicy(parentPolicyClone);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.