use of io.mycat.IOExecutor in project Mycat2 by MyCATApache.
the class ThreadMycatConnectionImplWrapper method prepareQuery.
@Override
public void prepareQuery(String sql, List<Object> params, MysqlCollector collector) {
IOExecutor ioExecutor = MetaClusterCurrent.wrapper(IOExecutor.class);
ioExecutor.executeBlocking(promise -> {
try {
this.stat.plusThread();
newMycatConnection.prepareQuery(sql, params, collector);
promise.tryComplete();
} catch (Exception e) {
promise.tryFail(e);
} finally {
this.stat.decThread();
}
});
}
use of io.mycat.IOExecutor in project Mycat2 by MyCATApache.
the class ThreadMycatConnectionImplWrapper method insert.
@Override
public Future<SqlResult> insert(String sql) {
IOExecutor ioExecutor = MetaClusterCurrent.wrapper(IOExecutor.class);
return ioExecutor.executeBlocking(promise -> {
try {
this.stat.plusThread();
newMycatConnection.insert(sql).onComplete(promise);
} catch (Exception e) {
promise.tryFail(e);
} finally {
this.stat.decThread();
}
});
}
use of io.mycat.IOExecutor in project Mycat2 by MyCATApache.
the class ThreadMycatConnectionImplWrapper method query.
@Override
public Future<RowSet> query(String sql, List<Object> params) {
IOExecutor ioExecutor = MetaClusterCurrent.wrapper(IOExecutor.class);
return ioExecutor.executeBlocking(promise -> {
try {
this.stat.plusThread();
newMycatConnection.query(sql, params).onComplete(promise);
} catch (Exception e) {
promise.tryFail(e);
} finally {
this.stat.decThread();
}
});
}
use of io.mycat.IOExecutor in project Mycat2 by MyCATApache.
the class ThreadMycatConnectionImplWrapper method update.
@Override
public Future<SqlResult> update(String sql) {
IOExecutor ioExecutor = MetaClusterCurrent.wrapper(IOExecutor.class);
return ioExecutor.executeBlocking(promise -> {
try {
this.stat.plusThread();
newMycatConnection.update(sql).onComplete(promise);
} catch (Exception e) {
promise.tryFail(e);
} finally {
this.stat.decThread();
}
});
}
Aggregations