Difference between doStopService and stopService on GenericService components (ATG Oracle Commerce)

It is common that when you are working with a GenericService component you need to change properties on it, and those are not reflected when the service runs after the changes are made, for those cases you need to stop the service and start it again.

There are 2 methods doStopService and stopService.

So, what should I do, just doStopSerivce?, run both? if so in which order?



According to the API, here is what each method does.

stopService

public void stopService()
                 throws ServiceException
Stops the service. This will be called when the Service is being shut down, either by explicit instructions from the administrator, or for various other reasons. A Service should clean up any resources it is using, but should be prepared to restart itself. When asked to restart, its properties may have changed.

doStopService

public void doStopService()
                   throws ServiceException
This is called when a Service is required to shut down. The Service should respond by stopping any processes that it has started.

So here are the answers for the questions above:

You just need to run stopService, this will call doStopService on it, and it will do things like change running flag to false and clean up resources, meaning your properties changes will be grabbed next time the service Starts.


Comments