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

org.infinispan.transaction.xa.recovery.PreparedTxIterator Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.transaction.xa.recovery;

import javax.transaction.xa.Xid;
import java.util.HashSet;
import java.util.List;

/**
*  Default implementation for RecoveryIterator.
*
* @author [email protected]
* @since 5.0
*/
public class PreparedTxIterator implements RecoveryManager.RecoveryIterator {

   private final HashSet xids = new HashSet(4);

   @Override
   public boolean hasNext() {
      return !xids.isEmpty();
   }

   @Override
   public Xid[] next() {
      Xid[] result = xids.toArray(new Xid[xids.size()]);
      xids.clear();
      return result;
   }

   public void add(List xids) {
      this.xids.addAll(xids);
   }

   @Override
   public Xid[] all() {
      return next();
   }

   @Override
   public void remove() {
      throw new RuntimeException("Unsupported operation!");
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy