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

org.infinispan.batch.AutoBatchSupport Maven / Gradle / Ivy

package org.infinispan.batch;

import net.jcip.annotations.NotThreadSafe;
import org.infinispan.commons.CacheConfigurationException;
import org.infinispan.configuration.cache.Configuration;

/**
 * Enables for automatic batching.
 *
 * @author Manik Surtani (manik AT jboss DOT org)
 * @since 4.0
 */
@NotThreadSafe
public abstract class AutoBatchSupport {
   protected BatchContainer batchContainer;

   protected static void assertBatchingSupported(Configuration c) {
      if (!c.invocationBatching().enabled())
         throw new CacheConfigurationException("Invocation batching not enabled in current configuration! Please enable it.");
   }

   protected void startAtomic() {
      batchContainer.startBatch(true);
   }

   protected void endAtomic() {
      batchContainer.endBatch(true, true);
   }

   protected void failAtomic() {
      batchContainer.endBatch(true, false);
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy