Aniruddh Joshi
Aniruddh Joshi

Reputation: 1795

Mule component lifecycle: What is the difference between stop and dispose?

The below link introduces life cycle events of a Mule component. http://www.mulesoft.org/documentation/display/current/Configuring+Components

I am unable to understand the difference between stop and dispose.

Description follows- stop:This is called when the MuleContext is stopped.

dispose: Called as the object is being disposed off. Typically this happens because either the MuleContext is shutting down.

Would be great if someone can help me understand.

Upvotes: 1

Views: 1319

Answers (1)

Anirban Sen Chowdhary
Anirban Sen Chowdhary

Reputation: 8311

Stop is just stoping the state of MuleContext where as dispose is same as destroy method of Spring beans... Here MuleContext state release all the resources allocated to it and the service is destroyed ... MuleContext.dispose should call stop on started connectors and then dispose ... Dispose is the last step and the thread is removed completely... MuleContext can switch between start and stop but once it is destroyed it cannot be started for that thread and that Thread is completely removed .. So, As I mentioned .. Dispose is the last state .... Also pls refer :- https://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/lifecycle/package-summary.html

Upvotes: 2

Related Questions