Search in sources :

Example 26 with PhysicalDBNode

use of com.actiontech.dble.backend.datasource.PhysicalDBNode in project dble by actiontech.

the class SingleNodeHandler method execute.

public void execute() throws Exception {
    startTime = System.currentTimeMillis();
    ServerConnection sc = session.getSource();
    waitingResponse = true;
    this.packetId = 0;
    final BackendConnection conn = session.getTarget(node);
    node.setRunOnSlave(rrs.getRunOnSlave());
    if (session.tryExistsCon(conn, node)) {
        execute(conn);
    } else {
        // create new connection
        node.setRunOnSlave(rrs.getRunOnSlave());
        ServerConfig conf = DbleServer.getInstance().getConfig();
        PhysicalDBNode dn = conf.getDataNodes().get(node.getName());
        dn.getConnection(dn.getDatabase(), session.getSource().isTxStart(), sc.isAutocommit(), node, this, node);
    }
}
Also used : PhysicalDBNode(com.actiontech.dble.backend.datasource.PhysicalDBNode) ServerConfig(com.actiontech.dble.config.ServerConfig) BackendConnection(com.actiontech.dble.backend.BackendConnection) ServerConnection(com.actiontech.dble.server.ServerConnection)

Example 27 with PhysicalDBNode

use of com.actiontech.dble.backend.datasource.PhysicalDBNode in project dble by actiontech.

the class LockTablesHandler method execute.

public void execute() throws Exception {
    super.reset(this.rrs.getNodes().length);
    for (final RouteResultsetNode node : rrs.getNodes()) {
        BackendConnection conn = session.getTarget(node);
        if (session.tryExistsCon(conn, node)) {
            innerExecute(conn, node);
        } else {
            // create new connection
            PhysicalDBNode dn = DbleServer.getInstance().getConfig().getDataNodes().get(node.getName());
            dn.getConnection(dn.getDatabase(), session.getSource().isTxStart(), autocommit, node, this, node);
        }
    }
}
Also used : PhysicalDBNode(com.actiontech.dble.backend.datasource.PhysicalDBNode) BackendConnection(com.actiontech.dble.backend.BackendConnection) RouteResultsetNode(com.actiontech.dble.route.RouteResultsetNode)

Aggregations

PhysicalDBNode (com.actiontech.dble.backend.datasource.PhysicalDBNode)27 ServerConfig (com.actiontech.dble.config.ServerConfig)9 RouteResultsetNode (com.actiontech.dble.route.RouteResultsetNode)9 PhysicalDBPool (com.actiontech.dble.backend.datasource.PhysicalDBPool)8 BackendConnection (com.actiontech.dble.backend.BackendConnection)7 SchemaConfig (com.actiontech.dble.config.model.SchemaConfig)5 SQLJob (com.actiontech.dble.sqlengine.SQLJob)4 PhysicalDatasource (com.actiontech.dble.backend.datasource.PhysicalDatasource)3 MySQLConnection (com.actiontech.dble.backend.mysql.nio.MySQLConnection)3 ERTable (com.actiontech.dble.config.model.ERTable)3 FirewallConfig (com.actiontech.dble.config.model.FirewallConfig)3 UserConfig (com.actiontech.dble.config.model.UserConfig)3 ConfigException (com.actiontech.dble.config.util.ConfigException)3 RowDataPacket (com.actiontech.dble.net.mysql.RowDataPacket)3 OneRawSQLQueryResultHandler (com.actiontech.dble.sqlengine.OneRawSQLQueryResultHandler)3 Map (java.util.Map)3 Set (java.util.Set)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 ConfigInitializer (com.actiontech.dble.config.ConfigInitializer)2 DBHostConfig (com.actiontech.dble.config.model.DBHostConfig)2