/** * PUBLIC: * Set the type of cache coordination that will be used on objects of this type. * Valid values defined in CacheCoordinationType. */ public void setCacheCoordinationType(CacheCoordinationType type) { if (type == null) { setCacheSynchronizationType(UNDEFINED_OBJECT_CHANGE_BEHAVIOR); } else if (type == CacheCoordinationType.SEND_OBJECT_CHANGES) { setCacheSynchronizationType(SEND_OBJECT_CHANGES); } else if (type == CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS) { setCacheSynchronizationType(INVALIDATE_CHANGED_OBJECTS); } else if (type == CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES) { setCacheSynchronizationType(SEND_NEW_OBJECTS_WITH_CHANGES); } else if (type == CacheCoordinationType.NONE) { setCacheSynchronizationType(DO_NOT_SEND_CHANGES); } }
/** * PUBLIC: * Set the type of cache coordination that will be used on objects of this type. * Valid values defined in CacheCoordinationType. */ public void setCacheCoordinationType(CacheCoordinationType type) { if (type == null) { setCacheSynchronizationType(UNDEFINED_OBJECT_CHANGE_BEHAVIOR); } else if (type == CacheCoordinationType.SEND_OBJECT_CHANGES) { setCacheSynchronizationType(SEND_OBJECT_CHANGES); } else if (type == CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS) { setCacheSynchronizationType(INVALIDATE_CHANGED_OBJECTS); } else if (type == CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES) { setCacheSynchronizationType(SEND_NEW_OBJECTS_WITH_CHANGES); } else if (type == CacheCoordinationType.NONE) { setCacheSynchronizationType(DO_NOT_SEND_CHANGES); } }
/** * PUBLIC: * Set the type of cache synchronization that will be used on objects of this type. Possible values * are: * SEND_OBJECT_CHANGES * INVALIDATE_CHANGED_OBJECTS * SEND_NEW_OBJECTS_WITH_CHANGES * DO_NOT_SEND_CHANGES * Note: Cache Synchronization type cannot be altered for descriptors that are set as isolated using * the setIsIsolated method. * @param type int The synchronization type for this descriptor * */ public void setCacheSynchronizationType(int type) { getCachePolicy().setCacheSynchronizationType(type); }
/** * PUBLIC: * Set the type of cache synchronization that will be used on objects of this type. Possible values * are: * SEND_OBJECT_CHANGES * INVALIDATE_CHANGED_OBJECTS * SEND_NEW_OBJECTS_WITH_CHANGES * DO_NOT_SEND_CHANGES * Note: Cache Synchronization type cannot be altered for descriptors that are set as isolated using * the setIsIsolated method. * @param type int The synchronization type for this descriptor * */ public void setCacheSynchronizationType(int type) { getCachePolicy().setCacheSynchronizationType(type); }
classDescriptor.getCachePolicy().setCacheSynchronizationType(ClassDescriptor.SEND_OBJECT_CHANGES); } else if (m_coordinationType.equals(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS.name())) { classDescriptor.getCachePolicy().setCacheSynchronizationType(ClassDescriptor.INVALIDATE_CHANGED_OBJECTS); } else if (m_coordinationType.equals(CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES.name())) { classDescriptor.getCachePolicy().setCacheSynchronizationType(ClassDescriptor.SEND_NEW_OBJECTS_WITH_CHANGES); } else if (m_coordinationType.equals(CacheCoordinationType.NONE.name())) { classDescriptor.getCachePolicy().setCacheSynchronizationType(ClassDescriptor.DO_NOT_SEND_CHANGES);
/** * INTERNAL: * Allow the inheritance properties of the descriptor to be initialized. * The descriptor's parent must first be initialized. */ public void initializeFromParent(CachePolicy parentPolicy, ClassDescriptor descriptor, ClassDescriptor descriptorDescriptor, AbstractSession session) throws DescriptorException { // If the parent is isolated, then the child must also be isolated. if (!parentPolicy.isSharedIsolation()) { // Do not override cache isolation when explicitly enabled by @Cacheable(true) annotation in current class. boolean copyParrent = cacheable == null || cacheable == false; if (!isIsolated() && (getCacheIsolation() != parentPolicy.getCacheIsolation()) && copyParrent) { session.log(SessionLog.WARNING, SessionLog.METADATA, "overriding_cache_isolation", new Object[]{descriptorDescriptor.getAlias(), parentPolicy.getCacheIsolation(), descriptor.getAlias(), getCacheIsolation()}); setCacheIsolation(parentPolicy.getCacheIsolation()); } } // Child must maintain the same indexes as the parent. for (CacheIndex index : parentPolicy.getCacheIndexes().values()) { addCacheIndex(index); } if ((getDatabaseChangeNotificationType() == null) && (parentPolicy.getDatabaseChangeNotificationType() != null)) { setDatabaseChangeNotificationType(parentPolicy.getDatabaseChangeNotificationType()); } if ((getCacheSynchronizationType() == UNDEFINED_OBJECT_CHANGE_BEHAVIOR) && (parentPolicy.getCacheSynchronizationType() != UNDEFINED_OBJECT_CHANGE_BEHAVIOR)) { setCacheSynchronizationType(parentPolicy.getCacheSynchronizationType()); } }
/** * INTERNAL: * Allow the inheritance properties of the descriptor to be initialized. * The descriptor's parent must first be initialized. */ public void initializeFromParent(CachePolicy parentPolicy, ClassDescriptor descriptor, ClassDescriptor descriptorDescriptor, AbstractSession session) throws DescriptorException { // If the parent is isolated, then the child must also be isolated. if (!parentPolicy.isSharedIsolation()) { // Do not override cache isolation when explicitly enabled by @Cacheable(true) annotation in current class. boolean copyParrent = cacheable == null || cacheable == false; if (!isIsolated() && (getCacheIsolation() != parentPolicy.getCacheIsolation()) && copyParrent) { session.log(SessionLog.WARNING, SessionLog.METADATA, "overriding_cache_isolation", new Object[]{descriptorDescriptor.getAlias(), parentPolicy.getCacheIsolation(), descriptor.getAlias(), getCacheIsolation()}); setCacheIsolation(parentPolicy.getCacheIsolation()); } } // Child must maintain the same indexes as the parent. for (CacheIndex index : parentPolicy.getCacheIndexes().values()) { addCacheIndex(index); } if ((getDatabaseChangeNotificationType() == null) && (parentPolicy.getDatabaseChangeNotificationType() != null)) { setDatabaseChangeNotificationType(parentPolicy.getDatabaseChangeNotificationType()); } if ((getCacheSynchronizationType() == UNDEFINED_OBJECT_CHANGE_BEHAVIOR) && (parentPolicy.getCacheSynchronizationType() != UNDEFINED_OBJECT_CHANGE_BEHAVIOR)) { setCacheSynchronizationType(parentPolicy.getCacheSynchronizationType()); } }