private final String type;
+ private final TransactionContextFactory txContextFactory;
+
public DistributedDataStore(ActorSystem actorSystem, ClusterWrapper cluster,
Configuration configuration, DatastoreContext datastoreContext) {
Preconditions.checkNotNull(actorSystem, "actorSystem should not be null");
this.waitTillReadyTimeInMillis =
actorContext.getDatastoreContext().getShardLeaderElectionTimeout().duration().toMillis() * READY_WAIT_FACTOR;
+ this.txContextFactory = TransactionContextFactory.create(actorContext);
datastoreConfigMXBean = new DatastoreConfigurationMXBeanImpl(datastoreContext.getDataStoreMXBeanType());
datastoreConfigMXBean.setContext(datastoreContext);
public DistributedDataStore(ActorContext actorContext) {
this.actorContext = Preconditions.checkNotNull(actorContext, "actorContext should not be null");
+ this.txContextFactory = TransactionContextFactory.create(actorContext);
this.type = UNKNOWN_TYPE;
this.waitTillReadyTimeInMillis =
actorContext.getDatastoreContext().getShardLeaderElectionTimeout().duration().toMillis() * READY_WAIT_FACTOR;
-
}
public void setCloseable(AutoCloseable closeable) {
@Override
public DOMStoreTransactionChain createTransactionChain() {
- return new TransactionChainProxy(actorContext);
+ return txContextFactory.createTransactionChain();
}
@Override
public DOMStoreReadTransaction newReadOnlyTransaction() {
- return new TransactionProxy(actorContext, TransactionType.READ_ONLY);
+ return new TransactionProxy(txContextFactory, TransactionType.READ_ONLY);
}
@Override
public DOMStoreWriteTransaction newWriteOnlyTransaction() {
actorContext.acquireTxCreationPermit();
- return new TransactionProxy(actorContext, TransactionType.WRITE_ONLY);
+ return new TransactionProxy(txContextFactory, TransactionType.WRITE_ONLY);
}
@Override
public DOMStoreReadWriteTransaction newReadWriteTransaction() {
actorContext.acquireTxCreationPermit();
- return new TransactionProxy(actorContext, TransactionType.READ_WRITE);
+ return new TransactionProxy(txContextFactory, TransactionType.READ_WRITE);
}
@Override
datastoreConfigMXBean.unregisterMBean();
datastoreInfoMXBean.unregisterMBean();
- if(closeable != null) {
+ if (closeable != null) {
try {
closeable.close();
} catch (Exception e) {
}
}
+ txContextFactory.close();
actorContext.shutdown();
DistributedDataStoreFactory.destroyInstance(this);
}