use of io.mycat.proxy.reactor.ReactorEnvThread in project Mycat2 by MyCATApache.
the class Session method lazyClose.
default PromiseInternal<Void> lazyClose(boolean normal, String hint) {
PromiseInternal<Void> promise = VertxUtil.newPromise();
getIOThread().addNIOJob(new NIOJob() {
@Override
public void run(ReactorEnvThread reactor) throws Exception {
close(normal, hint).onComplete(o -> promise.tryComplete());
}
@Override
public void stop(ReactorEnvThread reactor, Exception reason) {
close(normal, hint).onComplete(o -> promise.tryComplete());
}
@Override
public String message() {
return hint;
}
});
return promise;
}
use of io.mycat.proxy.reactor.ReactorEnvThread in project Mycat2 by MyCATApache.
the class MySQLAPIRuntimeImpl method addPengdingJob.
@Override
public void addPengdingJob(MySQLJobCallback callback) {
MycatReactorThread thread = (MycatReactorThread) Thread.currentThread();
thread.addNIOJob(new NIOJob() {
@Override
public void run(ReactorEnvThread reactor) throws Exception {
callback.run();
}
@Override
public void stop(ReactorEnvThread reactor, Exception reason) {
callback.stop(reason);
}
@Override
public String message() {
return callback.message();
}
});
}
Aggregations