I never use WrapperSimpleApp because of its lack of a controlled shutdown, and
WrapperStartStopApp does not fit my usual pattern. Therefore, I always find
myself implementing WrapperListener (3rd integration option). The use of this
interface seems restricted to that of a helper class to launch the service,
however I often find myself wanting to implement this directly in the service
class itself.
In the service class main, the class could instantiate itself using arguments
directly from the .conf file. It could then pass itself to the WrapperManager
without any arguments, as they are no longer required. The WrapperManager could
then call start, again without any arguments, to run the service. Of course,
this would require an additional method for the WrapperManager, and probably a
new interface (modified WrapperListener). This sort of thing could be
implemented using existing methods, but you would be passing a lot of arguments
around for no reason.
The alternative is to create an interface that all my service classes must
implement, so that a generic WrapperListener implementor can provide a
controlled startup and shutdown. This can be implemented using the current API,
but does not seem as flexible.
What I want to avoid is having to create a WrapperListener implementation for
each service class I create. Not having to use reflection would also be nice...
Am I correct in wanting to do this? Am I missing something obvious? Any
comments welcome.
|