All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.hibernate.cache.v53.impl.LocalInvalidationInvocation Maven / Gradle / Ivy

There is a newer version: 14.0.0.Dev02
Show newest version
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or .
 */
package org.infinispan.hibernate.cache.v53.impl;

import java.util.concurrent.CompletableFuture;

import org.infinispan.hibernate.cache.commons.access.PutFromLoadValidator;
import org.infinispan.hibernate.cache.commons.util.InfinispanMessageLogger;

/**
 * Synchronization that should release the locks after invalidation is complete.
 *
 * @author Radim Vansa <[email protected]>
 */
public class LocalInvalidationInvocation implements Invocation {
   private final static InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog(LocalInvalidationInvocation.class);

   private final Object lockOwner;
   private final PutFromLoadValidator validator;
   private final Object key;

   public LocalInvalidationInvocation(PutFromLoadValidator validator, Object key, Object lockOwner) {
      assert lockOwner != null;
      this.validator = validator;
      this.key = key;
      this.lockOwner = lockOwner;
   }

   @Override
   public CompletableFuture invoke(boolean success) {
      if (log.isTraceEnabled()) {
         log.tracef("After completion callback, success=%b", success);
      }
      validator.endInvalidatingKey(lockOwner, key, success);
      return null;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy