Home > Article > Backend Development > Apache Mina study notes (7) - Handler
IoHandler has the following functions:
sessionCreated sessionOpened sessionClosed sessionIdle exceptionCaught messageReceived messageSent
sessionCreated Event
The Session Created event occurs when a connection is created. For TCP, the result is that the connection is accepted, and for UDP, the UDP packet is accepted. This function can be used to initialize session parameters.
sessionOpened Event
The session opened event occurs when a connection is opened. It is always called after the sessionCreated event. If a thread model is configured, then this function is called in that thread instead of the I/O processing thread.
sessionClosed Event
This event occurs when a session is closed.
sessionidle Event
This event occurs when a session is idle, but this function does not work for the UDP protocol.
exceptionCaught Event
This function is called when an Exception is thrown.
messageReceived Event
This event occurs when a message arrives.
messageSent Event
This event occurs when sending, such as calling IoSession.write()
The above is the content of Apache Mina study notes (7) - Handler, more For more related content, please pay attention to the PHP Chinese website (www.php.cn)!