6666import org .apache .synapse .mediators .template .TemplateMediator ;
6767import org .apache .synapse .message .processor .MessageProcessor ;
6868import org .apache .synapse .message .processor .impl .AbstractMessageProcessor ;
69+ import org .apache .synapse .message .store .AbstractMessageStore ;
6970import org .apache .synapse .message .store .MessageStore ;
7071import org .apache .synapse .registry .Registry ;
7172import org .apache .synapse .startup .quartz .StartUpController ;
@@ -1600,11 +1601,6 @@ public synchronized void destroy(boolean preserverState) {
16001601 }
16011602 }
16021603
1603- // destroy the managed mediators
1604- for (ManagedLifecycle seq : getDefinedSequences ().values ()) {
1605- seq .destroy ();
1606- }
1607-
16081604 //destroy sequence templates
16091605 for (TemplateMediator seqTemplate : getSequenceTemplates ().values ()) {
16101606 seqTemplate .destroy ();
@@ -1616,11 +1612,6 @@ public synchronized void destroy(boolean preserverState) {
16161612 // from registry. Only un-deployment should remove task from registry. Ref product-ei#1206
16171613 endpoint .destroy (false );
16181614 }
1619-
1620- // destroy the managed endpoints
1621- for (Endpoint endpoint : getDefinedEndpoints ().values ()) {
1622- endpoint .destroy ();
1623- }
16241615
16251616 // destroy the startups
16261617 for (ManagedLifecycle stp : startups .values ()) {
@@ -1657,16 +1648,22 @@ public synchronized void destroy(boolean preserverState) {
16571648
16581649 // destroy the Message Stores
16591650 for (MessageStore ms : messageStores .values ()) {
1660- if (ms instanceof AbstractMessageProcessor ) {
1661- ((AbstractMessageProcessor ) ms ).destroy (preserverState );
1662- } else {
1663- ms .destroy ();
1664- }
1651+ ms .destroy ();
16651652 }
16661653
16671654 for (API api : apiTable .values ()) {
16681655 api .destroy ();
16691656 }
1657+
1658+ // destroy the managed endpoints
1659+ for (Endpoint endpoint : getDefinedEndpoints ().values ()) {
1660+ endpoint .destroy ();
1661+ }
1662+
1663+ // destroy the managed sequences
1664+ for (ManagedLifecycle seq : getDefinedSequences ().values ()) {
1665+ seq .destroy ();
1666+ }
16701667 }
16711668
16721669 /**
0 commit comments