org.sirix.access.trx.TransactionManagerImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sirix-core Show documentation
Show all versions of sirix-core Show documentation
SirixDB is a hybrid on-disk and in-memory document oriented, versioned database system. It has a lightweight buffer manager, stores everything in a huge persistent and durable tree and allows efficient reconstruction of every revision. Furthermore, SirixDB implements change tracking, diffing and supports time travel queries.
package org.sirix.access.trx;
import org.sirix.api.Transaction;
import org.sirix.api.TransactionManager;
import javax.inject.Inject;
import java.util.HashSet;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
public final class TransactionManagerImpl implements TransactionManager {
private final Set transactions;
@Inject
public TransactionManagerImpl() {
transactions = new HashSet<>();
}
@Override
public Transaction beginTransaction() {
final Transaction trx = new TransactionImpl(this);
transactions.add(trx);
return trx;
}
@Override
public TransactionManager closeTransaction(final Transaction trx) {
transactions.remove(checkNotNull(trx));
return this;
}
@Override
public void close() {
transactions.forEach(Transaction::commit);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy