Search in sources :

Example 21 with InboundEndpoint

use of org.apache.synapse.inbound.InboundEndpoint in project wso2-synapse by wso2.

the class SynapseConfiguration method destroy.

public synchronized void destroy(boolean preserverState) {
    if (log.isDebugEnabled()) {
        log.debug("Destroying the Synapse Configuration");
    }
    // clear the timer tasks of Synapse
    synapseTimer.cancel();
    synapseTimer = null;
    // stop and shutdown all the proxy services
    for (ProxyService p : getProxyServices()) {
        if (p.getTargetInLineInSequence() != null) {
            p.getTargetInLineInSequence().destroy();
        }
        if (p.getTargetInLineOutSequence() != null) {
            p.getTargetInLineOutSequence().destroy();
        }
    }
    // destroy the managed mediators
    for (ManagedLifecycle seq : getDefinedSequences().values()) {
        seq.destroy();
    }
    // destroy sequence templates
    for (TemplateMediator seqTemplate : getSequenceTemplates().values()) {
        seqTemplate.destroy();
    }
    // destroy inbound endpoint
    for (InboundEndpoint endpoint : getInboundEndpoints()) {
        // This path trigger from server shutdown hook. So we don't want to remove scheduled inbound tasks
        // from registry. Only un-deployment should remove task from registry. Ref product-ei#1206
        endpoint.destroy(false);
    }
    // destroy the managed endpoints
    for (Endpoint endpoint : getDefinedEndpoints().values()) {
        endpoint.destroy();
    }
    // destroy the startups
    for (ManagedLifecycle stp : startups.values()) {
        stp.destroy();
    }
    // clear session information used for SA load balancing
    try {
        SALSessions.getInstance().reset();
        DataSourceRepositoryHolder.getInstance().getDataSourceRepositoryManager().clear();
    } catch (Throwable ignored) {
    }
    // destroy the priority executors.
    for (PriorityExecutor pe : executors.values()) {
        pe.destroy();
    }
    // destroy the Message Stores
    for (MessageStore ms : messageStores.values()) {
        if (ms instanceof AbstractMessageProcessor) {
            ((AbstractMessageProcessor) ms).destroy(preserverState);
        } else {
            ms.destroy();
        }
    }
    // destroy the Message processors
    for (MessageProcessor mp : messageProcessors.values()) {
        mp.destroy();
    }
    for (API api : apiTable.values()) {
        api.destroy();
    }
}
Also used : InboundEndpoint(org.apache.synapse.inbound.InboundEndpoint) MessageStore(org.apache.synapse.message.store.MessageStore) TemplateMediator(org.apache.synapse.mediators.template.TemplateMediator) InboundEndpoint(org.apache.synapse.inbound.InboundEndpoint) Endpoint(org.apache.synapse.endpoints.Endpoint) ProxyService(org.apache.synapse.core.axis2.ProxyService) AbstractMessageProcessor(org.apache.synapse.message.processor.impl.AbstractMessageProcessor) MessageProcessor(org.apache.synapse.message.processor.MessageProcessor) AbstractMessageProcessor(org.apache.synapse.message.processor.impl.AbstractMessageProcessor) API(org.apache.synapse.rest.API) PriorityExecutor(org.apache.synapse.commons.executors.PriorityExecutor) ManagedLifecycle(org.apache.synapse.ManagedLifecycle)

Aggregations

InboundEndpoint (org.apache.synapse.inbound.InboundEndpoint)21 SynapseException (org.apache.synapse.SynapseException)6 SequenceMediator (org.apache.synapse.mediators.base.SequenceMediator)6 OMElement (org.apache.axiom.om.OMElement)5 DeploymentException (org.apache.axis2.deployment.DeploymentException)4 ProxyService (org.apache.synapse.core.axis2.ProxyService)4 TestMediator (org.apache.synapse.mediators.TestMediator)4 TemplateMediator (org.apache.synapse.mediators.template.TemplateMediator)4 AspectConfiguration (org.apache.synapse.aspects.AspectConfiguration)3 PriorityExecutor (org.apache.synapse.commons.executors.PriorityExecutor)3 Endpoint (org.apache.synapse.endpoints.Endpoint)3 MessageProcessor (org.apache.synapse.message.processor.MessageProcessor)3 MessageStore (org.apache.synapse.message.store.MessageStore)3 API (org.apache.synapse.rest.API)3 File (java.io.File)2 Iterator (java.util.Iterator)2 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)2 ManagedLifecycle (org.apache.synapse.ManagedLifecycle)2 Mediator (org.apache.synapse.Mediator)2 Entry (org.apache.synapse.config.Entry)2