First understanding of the source code of mycat

PS: It is recommended to close the timer task when debugging, in the startup method.

PS: This blog is just for the record. . no others.

 

1, MycatServer This is to start the service and initialize all the basic components

Construction method

    (1), AIO connection group

    (2), the global serial number

    (3), XA transaction global ID generation

    (4), sequence processing object

    (5), Mycat memory management class

    (6), read the file configuration

    (7), timing thread pool, single thread thread pool

    (8), SQL logger

    (9), cache service initialization

    (10), route calculation initialization

    (11), SQL parser

    (12), catlet loader

startup method

     (1), manager (management service) ManagerConnectionFactory

                 NIOAcceptor

     (2), server (connection service) ServerConnectionFactory

                 NIOAcceptor

     (3), start the timer task

               a,

NIOAcceptor nio configuration, startup, and accepter operation

 

NIOreactor nio read and write

    Note that it is not necessary to be pitted here, nioreacter is not used for NIOAccepter, but also for mysql connection, so for one operation, the code of NIOreactor will be read and written twice

    Note, here is the start of all requests, you can start from this class to debug

 

NIOSocketWR

   Network data, read and write operations. NIOreactor call

   Note, here is the start of all requests, you can start from this class to debug

 

NIOConnection

     Connection class, used to encapsulate the connection from accepter to mysql

 

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326776389&siteId=291194637