Search in sources :

Example 1 with XaLogImpl

use of cn.mycat.vertx.xa.impl.XaLogImpl in project Mycat2 by MyCATApache.

the class MycatRouterConfigOps method getXaLog.

@NotNull
private Resource<XaLog> getXaLog(ServerConfig serverConfig, Resource<MySQLManager> mycatMySQLManagerResource) {
    if (MetaClusterCurrent.exist(XaLog.class) && mycatMySQLManagerResource.isBorrow()) {
        return Resource.of(MetaClusterCurrent.wrapper(XaLog.class), true);
    }
    MySQLManager mycatMySQLManager = mycatMySQLManagerResource.get();
    LocalXaMemoryRepositoryImpl localXaMemoryRepository = LocalXaMemoryRepositoryImpl.createLocalXaMemoryRepository(() -> mycatMySQLManager);
    XaLog xaLog = new XaLogImpl(localXaMemoryRepository, serverConfig.getMycatId(), Objects.requireNonNull(mycatMySQLManager));
    return Resource.of(xaLog, false);
}
Also used : MySQLManager(cn.mycat.vertx.xa.MySQLManager) LocalXaMemoryRepositoryImpl(cn.mycat.vertx.xa.impl.LocalXaMemoryRepositoryImpl) XaLogImpl(cn.mycat.vertx.xa.impl.XaLogImpl) XaLog(cn.mycat.vertx.xa.XaLog) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

MySQLManager (cn.mycat.vertx.xa.MySQLManager)1 XaLog (cn.mycat.vertx.xa.XaLog)1 LocalXaMemoryRepositoryImpl (cn.mycat.vertx.xa.impl.LocalXaMemoryRepositoryImpl)1 XaLogImpl (cn.mycat.vertx.xa.impl.XaLogImpl)1 NotNull (org.jetbrains.annotations.NotNull)1