|
From: Leif M. <le...@ta...> - 2006-06-22 16:50:29
|
Ok. It probably needs some more testing due to the scale of the
modifications. But the
new pause/resume feature has been committed to CVS if you want to try it
out.
The changes were all as I described.
Cheers,
Leif
Leif Mortenson wrote:
> Joos, Heather,
> I am working on it as we speak. It will be in the 3.2.1 release.
> There are some major
> changes to the state engine that are required so it is turning out to be
> a little more work than
> I had expected. I think I have everything worked out though.
>
> The Wrapper will allow 2 modes of operation. The first will stop
> the JVM whenever
> the service is paused. This stoppage will reset the failed invocation
> count and allow
> restarts from that state even if restarts have been disabled. A special
> case.
> The second mode will keep the JVM running while paused. But send an
> event to
> the JVM so it can handle it. If the JVM crashes for any reason while
> in this state,
> it will stay down until the service is continued. When continued, the
> exit will be
> counted and handled as a regular restart. If restarts are disabled or
> the restart count
> exceeds the configured max, the wrapper will stop at that point.
>
> In either mode, the service can be stopped while paused. If the JVM
> is running
> at the time, it can initiate the stop.
>
> The WrapperListener class itself can not be modified to handle the
> pause/continue
> events as the addition of such a method would break things for existing
> users. I had
> added a new event/listener hierarchy for 3.2.0 that is much more
> flexible. This new
> method allows you to handle this as follows:
>
> WrapperManager.addWrapperEventListener( new WrapperEventListener() {
> public void fired( WrapperEvent event ) {
> if ( event instanceof WrapperServiceControlEvent ) {
> WrapperServiceControlEvent scEvent =
> (WrapperServiceControlEvent)event;
> switch ( scEvent.getServiceControlCode() ) {
> case WrapperManager.SERVICE_CONTROL_CODE_PAUSE:
> myPauseCallback();
> break;
> case WrapperManager.SERVICE_CONTROL_CODE_CONTINUE:
> myContinueCallback();
> break;
> }
> }
> }
> }, WrapperEventListener.EVENT_FLAG_SERVICE );
>
> You can write the above code in 3.2.0, but those event values will never
> be received
> as things are implemented in that version. I haven't compiled the
> above, so hopefully
> there are no typos. :-)
>
> Cheers,
> Leif
>
|