-
Notifications
You must be signed in to change notification settings - Fork 0
QFJ Thread Model
Baoying Wang edited this page Jan 26, 2018
·
11 revisions
MORE DETAIL TO BE ADDED
recv : network -> mina IO handler threads -> QFJ Message dispatcher thread -> thread(s) for each session processing(Application Callback - single thread for all connections or each thread has its own thread)
send: client pub thread(build message, and invoke session.send) -> mina IO handler thread (if block sending is configured, send within client pub thread)
As mentioned in brief, the most important thread setup for recv is how many threads for the session. It is decided by which class is used for your Initiator/Acceptor.
| Acceptor/Initiator | Thread per session | Single Thread for all sessions |
|---|---|---|
| Acceptor | ThreadedSocketAcceptor | SocketAcceptor |
| Initiator | ThreadedSocketInitiator | SocketInitiator |
- Thread per session: Accepts connections and uses a separate thread per session to process messages.If you print thread name in Application callback, you will find the dff names for diff sessions.
* Single Thread for all sessions: a single thread to process messages for all. If you print thread name in Application callback, you will find the same name for diff sessions.
Session::sendRaw(Message msg, num(always 0)){
increase seq and set it to msg
send(String msgStr){
log msgStr
responder.send(msgStr){
netty write(SocketSynchronousWrites=N-default or Y)
}
}
persist the msgStr (PersistMessages=Y-default or N)
}