Search in sources :

Example 1 with MycatSession

use of io.mycat.proxy.session.MycatSession in project Mycat2 by MyCATApache.

the class MycatMonitorCallback method getSession.

static Session getSession() {
    SessionThread thread = getThread();
    Session curSession = thread.getCurSession();
    if (curSession instanceof MycatSession) {
        return curSession;
    } else if (curSession instanceof MySQLClientSession) {
        MycatSession mycatSession = ((MySQLClientSession) curSession).getMycat();
        if (mycatSession == null) {
            return curSession;
        } else {
            return mycatSession;
        }
    } else {
        throw new MycatException("unknown session");
    }
}
Also used : MycatSession(io.mycat.proxy.session.MycatSession) SessionThread(io.mycat.proxy.reactor.SessionThread) MycatException(io.mycat.MycatException) MySQLClientSession(io.mycat.proxy.session.MySQLClientSession) MycatSession(io.mycat.proxy.session.MycatSession) Session(io.mycat.proxy.session.Session) MySQLClientSession(io.mycat.proxy.session.MySQLClientSession)

Aggregations

MycatException (io.mycat.MycatException)1 SessionThread (io.mycat.proxy.reactor.SessionThread)1 MySQLClientSession (io.mycat.proxy.session.MySQLClientSession)1 MycatSession (io.mycat.proxy.session.MycatSession)1 Session (io.mycat.proxy.session.Session)1