diff --git a/reactor/etc/reactor.png b/reactor/etc/reactor.png new file mode 100644 index 0000000000000000000000000000000000000000..0b00ec98be5ccdbeeb74d71241de065e3d733554 Binary files /dev/null and b/reactor/etc/reactor.png differ diff --git a/reactor/etc/reactor.ucls b/reactor/etc/reactor.ucls new file mode 100644 index 0000000000000000000000000000000000000000..d072e40299aa3383fe1babdd3960249f10eb96c0 --- /dev/null +++ b/reactor/etc/reactor.ucls @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/reactor/index.md b/reactor/index.md new file mode 100644 index 0000000000000000000000000000000000000000..7333c74dd228fb5fdfdc5df7f9d5ae82fb1632c3 --- /dev/null +++ b/reactor/index.md @@ -0,0 +1,30 @@ +--- +layout: pattern +title: Reactor +folder: reactor +permalink: /patterns/reactor/ +categories: Architectural +tags: + - Java + - Difficulty-Expert +--- + +**Intent:** 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. Dispatching of event handlers is performed by an initiation dispatcher, which manages the registered event handlers. Demultiplexing of service requests is performed by a synchronous event demultiplexer. + +![Reactor](./etc/reactor.png "Reactor") + +**Applicability:** Use Reactor pattern when + +* a server application needs to handle concurrent service requests from multiple clients. +* a server application needs to be available for receiving requests from new clients even when handling older client requests. +* a server must maximize throughput, minimize latency and use CPU efficiently without blocking. + +**Real world examples:** + +* [Spring Reactor](http://projectreactor.io/) + +**Credits** + +* [Douglas C. Schmidt - Reactor](https://www.dre.vanderbilt.edu/~schmidt/PDF/Reactor.pdf) +* [Doug Lea - Scalable IO in Java](http://gee.cs.oswego.edu/dl/cpjslides/nio.pdf) +* [Netty](http://netty.io/)