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

io.sirix.access.trx.TransactionManagerImpl Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 0.11.0
Show newest version
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