2.5 Starting and Stopping the Reactor

The process of starting and stopping the reactor may be carried out using only the ReactorControl interface, typically in the context of the main application thread. A simple example of starting and stopping the reactor from the main application thread is shown in Listing 2.7. This is present in the reactor examples package as ReactorStartupExample.


\begin{listing}
% latex2html id marker 441\begin{small}\begin{verbatim}publi...
...\end{verbatim} \end{small}\caption{Simple Reactor Startup Example}
\end{listing}

This example includes all the code which is required for managing the Reactor lifecycle in a standard Java application. When the reactor is run as an OSGi service this will all be done automatically, since the reactor lifecycle is managed by the OSGi container.