public void doPostCommit(
     SimpleCache<Serializable, ValueHolder<BV>> sharedCache,
     Serializable key,
     boolean mutable,
     boolean allowEqualsCheck,
     boolean readOnly,
     TransactionStats stats) {
   ValueHolder<BV> sharedObjValueHolder = sharedCache.get(key);
   if (sharedObjValueHolder == null) {
     // Someone removed the value
     if (!mutable) {
       // We can assume that our value is correct because it's immutable
       TransactionalCache.putSharedCacheValue(sharedCache, key, value, stats);
     } else {
       // The value is mutable, so we must behave pessimistically i.e. leave the shared cache
       // empty
     }
   } else if (!mutable) {
     // We assume the configuration is correct and therefore, that we do not need to compare
     // the cached value with the updated value.  This applies to null as well.
   } else if (allowEqualsCheck
       && EqualsHelper.nullSafeEquals(value, sharedObjValueHolder.getValue())) {
     // The value we want to write is the same as the one in the shared cache.
     // Don't write it unnecessarily.
   } else if (EqualsHelper.nullSafeEquals(originalValueHolder, sharedObjValueHolder)) {
     // The value in the cache did not change from what we observed before.
     // Update the value.
     TransactionalCache.putSharedCacheValue(sharedCache, key, value, stats);
   } else {
     // The shared value moved on in a way that was not possible to
     // validate.  We pessimistically remove the entry.
     sharedCache.remove(key);
   }
 }
 public void doPostCommit(
     SimpleCache<Serializable, ValueHolder<BV>> sharedCache,
     Serializable key,
     boolean mutable,
     boolean allowEqualsCheck,
     boolean readOnly,
     TransactionStats stats) {
   ValueHolder<BV> sharedObjValueHolder = sharedCache.get(key);
   if (sharedObjValueHolder == null) {
     // Nothing has changed, write it through
     TransactionalCache.putSharedCacheValue(sharedCache, key, value, stats);
   } else if (!mutable) {
     // Someone else put the object there
     // The assumption is that the value will be correct because the values are immutable
     // Don't write it unnecessarily.
   } else if (allowEqualsCheck
       && EqualsHelper.nullSafeEquals(value, sharedObjValueHolder.getValue())) {
     // The value we want to write is the same as the one in the shared cache.
     // Don't write it unnecessarily.
   } else {
     // The shared value moved on in a way that was not possible to
     // validate.  We pessimistically remove the entry.
     sharedCache.remove(key);
   }
 }
示例#3
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   } else if (obj instanceof AceEntity) {
     AceEntity that = (AceEntity) obj;
     return (EqualsHelper.nullSafeEquals(this.id, that.id));
   } else {
     return false;
   }
 }
 public boolean equals(Object obj) {
   if (obj == this) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (!(obj instanceof TransactionalCache<?, ?>)) {
     return false;
   }
   @SuppressWarnings("rawtypes")
   TransactionalCache that = (TransactionalCache) obj;
   return EqualsHelper.nullSafeEquals(this.name, that.name);
 }
示例#5
0
 public boolean equals(Object obj) {
   if (obj == null) {
     return false;
   } else if (obj == this) {
     return true;
   } else if (!(obj instanceof ChildAssoc)) {
     return false;
   }
   ChildAssoc that = (ChildAssoc) obj;
   if (EqualsHelper.nullSafeEquals(id, that.getId())) {
     return true;
   } else {
     return (EqualsHelper.nullSafeEquals(this.getParent(), that.getParent())
         && EqualsHelper.nullSafeEquals(this.typeQNameId, that.getTypeQNameId())
         && EqualsHelper.nullSafeEquals(this.getChild(), that.getChild())
         && EqualsHelper.nullSafeEquals(this.qnameLocalName, that.getQnameLocalName())
         && EqualsHelper.nullSafeEquals(this.qnameNamespaceId, that.getQnameNamespaceId()));
   }
 }