io.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 io.sirix.access.trx;
import io.sirix.api.Transaction;
import io.sirix.api.TransactionManager;
import javax.inject.Inject;
import java.util.HashSet;
import java.util.Set;
import static java.util.Objects.requireNonNull;
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(requireNonNull(trx));
return this;
}
@Override
public void close() {
transactions.forEach(Transaction::commit);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy