Codota Logo
CacheInvalidationPolicy.isInvalidated
Code IndexAdd Codota to your IDE (free)

How to use
isInvalidated
method
in
org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy

Best Java code snippets using org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy.isInvalidated (Showing top 20 results out of 315)

  • Common ways to obtain CacheInvalidationPolicy
private void myMethod () {
CacheInvalidationPolicy c =
  • Codota IconClassDescriptor classDescriptor;classDescriptor.getCacheInvalidationPolicy()
  • Smart code suggestions by Codota
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * return true if this object is expire, false otherwise.
 */
public abstract boolean isInvalidated(CacheKey key, long currentTimeMillis);
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * return true if this object is expire, false otherwise.
 */
public abstract boolean isInvalidated(CacheKey key, long currentTimeMillis);
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * return true if this object is expire, false otherwise.
 */
public abstract boolean isInvalidated(CacheKey key, long currentTimeMillis);
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * ADVANCED:
 * Using a list of Entity PK this method will attempt to bulk load the entire list from the cache.
 * In certain circumstances this can have large performance improvements over loading each item individually.
 * @param pkList List of Entity PKs to extract from the cache
 * @param ClassDescriptor Descriptor type to be retrieved.
 * @return Map of Entity PKs associated to the Entities that were retrieved
 * @throws QueryException
 */
public Map<Object, CacheKey> getAllCacheKeysFromIdentityMapWithEntityPK(Object[] pkList, ClassDescriptor descriptor, AbstractSession session){
  HashMap<Object, CacheKey> map = new HashMap<Object, CacheKey>();
  CacheKey cachedObject = null;
  long currentTime = System.currentTimeMillis();
  for (Object pk : pkList){
    cachedObject = getCacheKey(pk, false);
    if ((cachedObject != null && cachedObject.getObject() != null && !descriptor.getCacheInvalidationPolicy().isInvalidated(cachedObject, currentTime))){
      map.put(pk, cachedObject);
    }
  }
  return map;
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * ADVANCED:
 * Using a list of Entity PK this method will attempt to bulk load the entire list from the cache.
 * In certain circumstances this can have large performance improvements over loading each item individually.
 * @param pkList List of Entity PKs to extract from the cache
 * @param ClassDescriptor Descriptor type to be retrieved.
 * @return Map of Entity PKs associated to the Entities that were retrieved
 * @throws QueryException
 */
public Map<Object, CacheKey> getAllCacheKeysFromIdentityMapWithEntityPK(Object[] pkList, ClassDescriptor descriptor, AbstractSession session){
  HashMap<Object, CacheKey> map = new HashMap<Object, CacheKey>();
  CacheKey cachedObject = null;
  long currentTime = System.currentTimeMillis();
  for (Object pk : pkList){
    cachedObject = getCacheKey(pk, false);
    if ((cachedObject != null && cachedObject.getObject() != null && !descriptor.getCacheInvalidationPolicy().isInvalidated(cachedObject, currentTime))){
      map.put(pk, cachedObject);
    }
  }
  return map;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * ADVANCED:
 * Using a list of Entity PK this method will attempt to bulk load the entire list from the cache.
 * In certain circumstances this can have large performance improvements over loading each item individually.
 * @param pkList List of Entity PKs to extract from the cache
 * @param ClassDescriptor Descriptor type to be retrieved.
 * @return Map of Entity PKs associated to the Entities that were retrieved
 * @throws QueryException
 */
public Map<Object, Object> getAllFromIdentityMapWithEntityPK(Object[] pkList, ClassDescriptor descriptor, AbstractSession session){
  HashMap<Object, Object> map = new HashMap<Object, Object>();
  CacheKey cachedObject = null;
  long currentTime = System.currentTimeMillis();
  for (Object pk : pkList){
    cachedObject = getCacheKey(pk, false);
    if ((cachedObject != null && cachedObject.getObject() != null && !descriptor.getCacheInvalidationPolicy().isInvalidated(cachedObject, currentTime))){
      map.put(pk, cachedObject.getObject());
    }
  }
  return map;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * 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;
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * 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;
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * ADVANCED:
 * Using a list of Entity PK this method will attempt to bulk load the entire list from the cache.
 * In certain circumstances this can have large performance improvements over loading each item individually.
 * @param pkList List of Entity PKs to extract from the cache
 * @param ClassDescriptor Descriptor type to be retrieved.
 * @return Map of Entity PKs associated to the Entities that were retrieved
 * @throws QueryException
 */
public Map<Object, Object> getAllFromIdentityMapWithEntityPK(Object[] pkList, ClassDescriptor descriptor, AbstractSession session){
  HashMap<Object, Object> map = new HashMap<Object, Object>();
  CacheKey cachedObject = null;
  long currentTime = System.currentTimeMillis();
  for (Object pk : pkList){
    cachedObject = getCacheKey(pk, false);
    if ((cachedObject != null && cachedObject.getObject() != null && !descriptor.getCacheInvalidationPolicy().isInvalidated(cachedObject, currentTime))){
      map.put(pk, cachedObject.getObject());
    }
  }
  return map;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Return the cache key for the cache index or null if not found.
 */
public CacheKey getCacheKeyByIndex(CacheIndex index, CacheId indexValues, boolean shouldCheckExpiry, ClassDescriptor descriptor) {
  if (this.cacheIndexes == null) {
    return null;
  }
  IdentityMap map = this.cacheIndexes.get(index);
  if (map == null) {
    return null;
  }
  CacheKey cacheKey = map.getCacheKey(indexValues, false);
  if (cacheKey == null) {
    return null;
  }
  // The cache key is nested as the object cache key is put into the cache.
  cacheKey = (CacheKey)cacheKey.getObject();
  if (cacheKey == null) {
    return null;
  }
  if (shouldCheckExpiry && descriptor.getCacheInvalidationPolicy().isInvalidated(cacheKey)) {
    return null;
  }
  return cacheKey;
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * Return the cache key for the cache index or null if not found.
 */
public CacheKey getCacheKeyByIndex(CacheIndex index, CacheId indexValues, boolean shouldCheckExpiry, ClassDescriptor descriptor) {
  if (this.cacheIndexes == null) {
    return null;
  }       
  IdentityMap map = this.cacheIndexes.get(index);
  if (map == null) {
    return null;
  }
  CacheKey cacheKey = map.getCacheKey(indexValues, false);
  if (cacheKey == null) {
    return null;
  }
  // The cache key is nested as the object cache key is put into the cache.
  cacheKey = (CacheKey)cacheKey.getObject();
  if (cacheKey == null) {
    return null;
  }
  if (shouldCheckExpiry && descriptor.getCacheInvalidationPolicy().isInvalidated(cacheKey)) {
    return null;
  }
  return cacheKey;
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * 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;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Get the cached results associated with a query.  Results are cached by the
 * values of the parameters to the query so different parameters will have
 * different cached results.
 */
public Object getQueryResult(ReadQuery query, List parameters, boolean shouldCheckExpiry) {
  if (query.getQueryResultsCachePolicy() == null) {
    return null;
  }
  // PERF: use query name, unless no name.
  Object queryKey = query.getName();
  if ((queryKey == null) || ((String)queryKey).length() == 0) {
    queryKey = query;
  }
  IdentityMap map = this.queryResults.get(queryKey);
  if (map == null) {
    return null;
  }
  Object lookupParameters;
  if ((parameters == null) || parameters.isEmpty()) {
    lookupParameters = CacheId.EMPTY;
  } else {
    lookupParameters = new CacheId(parameters.toArray());
  }
  CacheKey key = map.getCacheKey(lookupParameters, false);
  if ((key == null) || (shouldCheckExpiry && query.getQueryResultsCachePolicy().getCacheInvalidationPolicy().isInvalidated(key))) {
    return null;
  }
  return key.getObject();
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * ADVANCED:
 * Return if this object is valid in the cache.
 */
public boolean isValid(Object primaryKey, Class theClass) {
  ClassDescriptor descriptor = getSession().getDescriptor(theClass);
  //forward the call to getCacheKeyForObject locally in case subclasses overload
  CacheKey key = getCacheKeyForObjectForLock(primaryKey, theClass, descriptor);
  if (key == null) {
    throw QueryException.classPkDoesNotExistInCache(theClass, primaryKey);
  }
  return !descriptor.getCacheInvalidationPolicy().isInvalidated(key);
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * ADVANCED:
 * Return if this object is valid in the cache.
 */
public boolean isValid(Object primaryKey, Class theClass) {
  ClassDescriptor descriptor = getSession().getDescriptor(theClass);
  //forward the call to getCacheKeyForObject locally in case subclasses overload
  CacheKey key = getCacheKeyForObjectForLock(primaryKey, theClass, descriptor);
  if (key == null) {
    throw QueryException.classPkDoesNotExistInCache(theClass, primaryKey);
  }
  return !descriptor.getCacheInvalidationPolicy().isInvalidated(key);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * ADVANCED:
 * Return if this object is valid in the cache.
 */
public boolean isValid(Vector primaryKey, Class theClass) {
  ClassDescriptor descriptor = getSession().getDescriptor(theClass);
  //forward the call to getCacheKeyForObject locally in case subclasses overload
  CacheKey key = this.getCacheKeyForObjectForLock(primaryKey, theClass, descriptor);
  if (key == null) {
    throw QueryException.classPkDoesNotExistInCache(theClass, primaryKey);
  }
  return !descriptor.getCacheInvalidationPolicy().isInvalidated(key);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Get the cached results associated with a query.  Results are cached by the
 * values of the parameters to the query so different parameters will have
 * different cached results.
 */
public Object getQueryResult(ReadQuery query, Vector parameters, boolean shouldCheckExpiry) {
  if (query.getQueryResultsCachePolicy() == null) {
    return null;
  }
  // PERF: use query name, unless no name.
  Object queryKey = query.getName();
  if ((queryKey == null) || ((String)queryKey).length() == 0) {
    queryKey = query;
  }
  IdentityMap map = this.queryResults.get(queryKey);
  if (map == null) {
    return null;
  }
  Vector lookupParameters = parameters;
  if (lookupParameters == null) {
    lookupParameters = new NonSynchronizedVector(0);
  }
  CacheKey key = map.getCacheKey(lookupParameters);
  if ((key == null) || (shouldCheckExpiry && query.getQueryResultsCachePolicy().getCacheInvalidationPolicy().isInvalidated(key))) {
    return null;
  }
  return key.getObject();
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * 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);
      parent.executeQuery(query);
    }
  }
}

origin: com.haulmont.thirdparty/eclipselink

/**
 * Returns true if the cache contains an Object with the id and Class type, and is valid.
 * @see Cache#contains(Class, Object)
 */
public boolean contains(Class cls, Object id) {
  getEntityManagerFactory().verifyOpen();
  Object pk =  createPrimaryKeyFromId(cls, id);
  if(null == pk) {
    return false;
  }
  ClassDescriptor descriptor = getSession().getClassDescriptor(cls); // getDescriptor() is the same call
  /**
   * Check for no descriptor associated with the class parameter.
   * This will occur if the class represents a MappedSuperclass (concrete or abstract class),
   * an interface or Embeddable class.
   */
  if(null == descriptor) {
    // do not throw an IAException: cache_impl_class_has_no_descriptor_is_not_a_persistent_type - just return false
    return false;
  }
  // we can assume that all implementors of IdentityMapAccessor implement getCacheKeyforObject
  CacheKey key = ((org.eclipse.persistence.internal.sessions.IdentityMapAccessor)getAccessor())
    .getCacheKeyForObject(pk, cls, descriptor, false);
  return key != null && key.getObject() != null && 
    !descriptor.getCacheInvalidationPolicy().isInvalidated(key);    
}
origin: com.haulmont.thirdparty/eclipselink

if ((cacheKey != null) && (shouldReturnInvalidatedObjects || !descriptor.getCacheInvalidationPolicy().isInvalidated(cacheKey))) {
org.eclipse.persistence.descriptors.invalidationCacheInvalidationPolicyisInvalidated

Javadoc

INTERNAL: return true if this object is expire, false otherwise.

Popular methods of CacheInvalidationPolicy

  • getExpiryTimeInMillis
    INTERNAL: Get the next time when this object will become invalid
  • getRemainingValidTime
    INTERNAL: Return the remaining life of this object
  • shouldUpdateReadTimeOnUpdate
    PUBLIC: Return whether objects affected by this CacheInvalidationPolicy should have the read time on
  • clone
  • setIsInvalidationRandomized
    PUBLIC: Allows the timeToLive to be randomized to avoid bottlenecks.
  • setShouldRefreshInvalidObjectsOnClone
    PUBLIC: Set if expired object should be refreshed prior to cloning, default is true. Applies to Prot
  • setShouldUpdateReadTimeOnUpdate
    PUBLIC: Set whether to update the stored time an object was read when an object is updated. When the
  • shouldRefreshInvalidObjectsOnClone
    PUBLIC: Return if expired object should be refreshed prior to cloning. Applies to Protected Entities
  • shouldRefreshInvalidObjectsInUnitOfWork
    PUBLIC: Return if expired object registered in the unit of work should be refreshed.

Popular in Java

  • Creating JSON documents from java classes using gson
  • compareTo (BigDecimal)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • setContentView (Activity)
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • JFileChooser (javax.swing)
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now