Improve Javadoc

This commit is contained in:
baislsl
2018-02-19 22:01:14 +08:00
parent d78434fed8
commit 991ba320a6
30 changed files with 88 additions and 80 deletions

View File

@ -39,13 +39,13 @@ import com.iluwatar.reactor.framework.ThreadPoolDispatcher;
* Service where it listens on multiple TCP or UDP sockets for incoming log requests.
*
* <p>
* <i>INTENT</i> <br/>
* <i>INTENT</i> <br>
* The Reactor design pattern handles service requests that are delivered concurrently to an
* application by one or more clients. The application can register specific handlers for processing
* which are called by reactor on specific events.
*
* <p>
* <i>PROBLEM</i> <br/>
* <i>PROBLEM</i> <br>
* Server applications in a distributed system must handle multiple clients that send them service
* requests. Following forces need to be resolved:
* <ul>
@ -56,31 +56,36 @@ import com.iluwatar.reactor.framework.ThreadPoolDispatcher;
* </ul>
*
* <p>
* <i>PARTICIPANTS</i> <br/>
* <i>PARTICIPANTS</i> <br>
* <ul>
* <li>Synchronous Event De-multiplexer</li> {@link NioReactor} plays the role of synchronous event
* de-multiplexer. It waits for events on multiple channels registered to it in an event loop.
*
* <li>Synchronous Event De-multiplexer
* <p>
* <li>Initiation Dispatcher</li> {@link NioReactor} plays this role as the application specific
* {@link ChannelHandler}s are registered to the reactor.
*
* {@link NioReactor} plays the role of synchronous event de-multiplexer.
* It waits for events on multiple channels registered to it in an event loop.
* </p>
* </li>
* <li>Initiation Dispatcher
* <p>
* <li>Handle</li> {@link AbstractNioChannel} acts as a handle that is registered to the reactor.
* {@link NioReactor} plays this role as the application specific {@link ChannelHandler}s are registered to the reactor.
* </p>
* </li>
* <li>Handle
* <p>
* {@link AbstractNioChannel} acts as a handle that is registered to the reactor.
* When any events occur on a handle, reactor calls the appropriate handler.
*
* </p>
* </li>
* <li>Event Handler
* <p>
* <li>Event Handler</li> {@link ChannelHandler} acts as an event handler, which is bound to a
* {@link ChannelHandler} acts as an event handler, which is bound to a
* channel and is called back when any event occurs on any of its associated handles. Application
* logic resides in event handlers.
* </p>
* </li>
* </ul>
*
* <p>
* The application utilizes single thread to listen for requests on all ports. It does not create a
* separate thread for each client, which provides better scalability under load (number of clients
* increase).
*
* <p>
* The example uses Java NIO framework to implement the Reactor.
*
*/

View File

@ -108,7 +108,7 @@ public class AppClient {
* Creates a new TCP logging client.
*
* @param clientName the name of the client to be sent in logging requests.
* @param port the port on which client will send logging requests.
* @param serverPort the port on which client will send logging requests.
*/
public TcpLoggingClient(String clientName, int serverPort) {
this.clientName = clientName;

View File

@ -141,7 +141,7 @@ public abstract class AbstractNioChannel {
* when this method returns. It will be written when the channel is flushed.
*
* <p>
* This method is used by the {@link ChannelHandler} to send reply back to the client. <br/>
* This method is used by the {@link ChannelHandler} to send reply back to the client. <br>
* Example:
*
* <pre>

View File

@ -28,7 +28,7 @@ import java.nio.channels.SelectionKey;
* Represents the event dispatching strategy. When {@link NioReactor} senses any event on the
* registered {@link AbstractNioChannel}s then it de-multiplexes the event type, read or write or
* connect, and then calls the {@link Dispatcher} to dispatch the read events. This decouples the
* I/O processing from application specific processing. <br/>
* I/O processing from application specific processing. <br>
* Dispatcher should call the {@link ChannelHandler} associated with the channel on which event
* occurred.
*

View File

@ -37,7 +37,7 @@ import java.nio.channels.SelectionKey;
public class SameThreadDispatcher implements Dispatcher {
/**
* Dispatches the read event in the context of caller thread. <br/>
* Dispatches the read event in the context of caller thread. <br>
* Note this is a blocking call. It returns only after the associated handler has handled the read
* event.
*/

View File

@ -47,7 +47,7 @@ public class ThreadPoolDispatcher implements Dispatcher {
/**
* Submits the work of dispatching the read event to worker pool, where it gets picked up by
* worker threads. <br/>
* worker threads. <br>
* Note that this is a non-blocking call and returns immediately. It is not guaranteed that the
* event has been handled by associated handler.
*/