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

org.infinispan.hibernate.cache.v53.impl.RemovalInvocation 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.functional.FunctionalMap;
import org.infinispan.hibernate.cache.commons.InfinispanDataRegion;
import org.infinispan.hibernate.cache.commons.util.VersionedEntry;

/**
 * @author Radim Vansa <[email protected]>
 */
public class RemovalInvocation implements Invocation {
   private final InfinispanDataRegion region;
   private final Object key;
   private final FunctionalMap.ReadWriteMap rwMap;

   public RemovalInvocation(FunctionalMap.ReadWriteMap rwMap, InfinispanDataRegion region, Object key) {
      this.rwMap = rwMap;
      this.region = region;
      this.key = key;
   }

   @Override
   public CompletableFuture invoke(boolean success) {
      if (success) {
         return rwMap.eval(key, new VersionedEntry(region.nextTimestamp()));
      } else {
         return null;
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy