I'm writing a Stomp protocol client with Java and it has only one thread to process IO. That means that thread reads and writes incoming data to the application back and forth. My issue is if I need to scale this application in future with multi threading and NIO, how that could be arranged?
my IO processor thread is called "TcpLink" link and it has following skeletion
class TcpLink implements Runnable {
public void run() {
// read data from socket and assign it to a byte buffer
// notify the listening application
}
}
If I need to allow multiple threads to dispatch the incoming messages, how this class should be changed?
thanks!