The whole tenet networking part is quite simple, the main components are :
Encoder, Encoder determines how your POJO should be encoded into a WriteBuffer for transferringDecoder, Decoder determines how to decode a POJO from the target ReadBufferHandler, Handler is where you put your specific business logic, to process the data receivedProvider, Provider determines how a Sentry object could be created, and what to be done when the application exit
About concrete networking protocol, they are divided into two phases:
Sentryphase, where the read-write model are fully controlled by developers only, all the stuff like Encoder, Decoder, Handler are not functional yet, during sentry phase, the connection must have been well established, and ready for further exchange of dataProtocolphase, where Encoder, Decoder, Handler would take over the control, reading from channel and writing data to channel are well organized by tenet
Each TCP connection will be represented as an Channel, the Channel was first mounted on a Poller thread in Sentry phase, if it successfully upgraded to Protocol phase, it will be also mounted on Writer thread.
All the server socket were registered to a single Net thread, and the default Poller and Writer threads are the number of your CPU cores.
Poller thread will handle the reading part of the socket, Writer thread will handle the writing part of the socket, the access to the critical section will be managed through a locking mechanism.
A small echo example could be found in echo example
A simple http example could be found in http example
Note that in order to run tenet application, you need to specify some arguments in system properties:
--enable-preview
--enable-native-access=ALL-UNNAMED
-DTENET_LIBRARY_PATH=/path/to/lib