use of com.torodb.mongodb.core.MongodConnection in project torodb by torodb.
the class TorodbSafeRequestProcessor method openConnection.
@Override
public MongodConnection openConnection() {
MongodConnection connection = server.openConnection();
LOGGER.info("Accepted connection {}", connection.getConnectionId());
return connection;
}
use of com.torodb.mongodb.core.MongodConnection in project torodb by torodb.
the class SimpleAnalyzedOplogBatchExecutor method execute.
@Override
public void execute(OplogOperation op, ApplierContext context) throws OplogApplyingException, RollbackException, UserException {
try (MongodConnection connection = server.openConnection();
ExclusiveWriteMongodTransaction mongoTransaction = connection.openExclusiveWriteTransaction()) {
oplogOperationApplier.apply(op, mongoTransaction, context);
mongoTransaction.commit();
}
}
use of com.torodb.mongodb.core.MongodConnection in project torodb by torodb.
the class BDDOplogTest method execute.
@Override
public void execute(OplogTestContext context) throws Exception {
MongodServer server = context.getMongodServer();
try (MongodConnection conn = server.openConnection()) {
try (WriteMongodTransaction trans = conn.openWriteTransaction(true)) {
given(trans);
trans.commit();
}
}
context.apply(streamOplog(), getApplierContext());
try (MongodConnection conn = server.openConnection()) {
try (ReadOnlyMongodTransaction trans = conn.openReadOnlyTransaction()) {
then(trans);
}
}
}
use of com.torodb.mongodb.core.MongodConnection in project torodb by torodb.
the class AkkaDbCloner method createWriteMongodTransaction.
private WriteMongodTransaction createWriteMongodTransaction(MongodServer server) {
MongodConnection connection = server.openConnection();
WriteMongodTransaction delegateTransaction = connection.openWriteTransaction();
return new CloseConnectionWriteMongodTransaction(delegateTransaction);
}
Aggregations