Package org.apache.synapse.commons.executors

Examples of org.apache.synapse.commons.executors.PriorityExecutor


    }

    public static PriorityExecutor defineExecutor(SynapseConfiguration config,
                                                       OMElement elem, Properties properties) {

        PriorityExecutor executor = null;
        try {
            executor = PriorityExecutorFactory.createExecutor(
                    XMLConfigConstants.SYNAPSE_NAMESPACE, elem, true, properties);
            assert executor != null;
            config.addPriorityExecutor(executor.getName(), executor);
        } catch (AxisFault axisFault) {
            String msg = "Executor configuration cannot be built";
            handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_EXECUTORS, msg, axisFault);
        }
        return executor;
View Full Code Here


     *
     * @param name name of the executor
     * @return removed executor
     */
    public synchronized PriorityExecutor removeExecutor(String name) {
        PriorityExecutor executor = executors.remove(name);
        if (executor != null) {
            for (SynapseObserver o : observers) {
                o.priorityExecutorRemoved(executor);
            }
        }
View Full Code Here

            Iterator executors = FileUtils.iterateFiles(executorsDir, extensions, false);
            while (executors.hasNext()) {
                File file = (File) executors.next();
                OMElement document = getOMElement(file);
                PriorityExecutor executor = SynapseXMLConfigurationFactory.
                        defineExecutor(synapseConfig, document, properties);
                if (executor != null) {
                    executor.setFileName(file.getName());
                    synapseConfig.getArtifactDeploymentStore().addArtifact(
                            file.getAbsolutePath(), executor.getName());
                }
            }
        }
    }
View Full Code Here

     *
     * @param name name of the executor
     * @return removed executor
     */
    public synchronized PriorityExecutor removeExecutor(String name) {
        PriorityExecutor executor = executors.remove(name);
        if (executor != null) {
            for (SynapseObserver o : observers) {
                o.priorityExecutorRemoved(executor);
            }
        }
View Full Code Here

        synapseConfig.addEventSource(eventSrc.getName(), eventSrc);
        assertItemAdded(eventSrc.getName(), EVENT_SRC);
        synapseConfig.removeEventSource(eventSrc.getName());
        assertItemRemoved(eventSrc.getName(), EVENT_SRC);

        PriorityExecutor exec = new PriorityExecutor();
        exec.setName("exec1");
        synapseConfig.addPriorityExecutor(exec.getName(), exec);
        assertItemAdded(exec.getName(), EXECUTOR);
        synapseConfig.removeExecutor(exec.getName());
        assertItemRemoved(exec.getName(), EXECUTOR);
    }
View Full Code Here

            }
            File[] events = eventsDir.listFiles(filter);
            for (File file : events) {
                try {
                    OMElement document = parseFile(file);
                    PriorityExecutor executor = SynapseXMLConfigurationFactory.
                            defineExecutor(synapseConfig, document, properties);
                    executor.setFileName(file.getName());
                    synapseConfig.getArtifactDeploymentStore().addArtifact(
                            file.getAbsolutePath(), executor.getName());
                } catch (FileNotFoundException ignored) {}
           }
        }
    }
View Full Code Here

            log.traceOrDebug("Start: enqueue mediator");
        }

        assert executorName != null : "executor name shouldn't be null";

        PriorityExecutor executor = synCtx.getConfiguration().
                getPriorityExecutors().get(executorName);
        if (executor == null) {
            handleException("executor cannot be found for the name : " + executorName, synCtx);
            return false;
        }


        Mediator m = synCtx.getSequence(sequenceName);
        if (m != null && m instanceof SequenceMediator) {
            MediatorWorker worker = new MediatorWorker(m, synCtx);
            // execute with the given priority
            executor.execute(worker, priority);

            // with the nio transport, this causes the listener not to write a 202
            // Accepted response, as this implies that Synapse does not yet know if
            // a 202 or 200 response would be written back.
            ((Axis2MessageContext) synCtx).getAxis2MessageContext().getOperationContext().setProperty(
View Full Code Here

        return eventSource;
    }

    public static PriorityExecutor defineExecutor(SynapseConfiguration config,
                                                       OMElement elem, Properties properties) {
        PriorityExecutor executor = null;
        try {
            executor = PriorityExecutorFactory.createExecutor(
                XMLConfigConstants.SYNAPSE_NAMESPACE, elem, true, properties);
        } catch (AxisFault axisFault) {
            handleException("Failed to create the priorityExecutor configuration");
        }
        assert executor != null;
        config.addPriorityExecutor(executor.getName(), executor);
        return executor;
    }
View Full Code Here

     *
     * @param name name of the executor
     * @return removed executor
     */
    public synchronized PriorityExecutor removeExecutor(String name) {
        PriorityExecutor executor = executors.remove(name);
        if (executor != null) {
            for (SynapseObserver o : observers) {
                o.priorityExecutorRemoved(executor);
            }
        }
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("PriorityExecutor Deployment from file : " + fileName + " : Started");
        }

        try {
            PriorityExecutor e = PriorityExecutorFactory.createExecutor(
                    SynapseConstants.SYNAPSE_NAMESPACE, artifactConfig, true, properties);
            if (e != null) {
                e.setFileName((new File(fileName)).getName());
                if (log.isDebugEnabled()) {
                    log.debug("PriorityExecutor with name '" + e.getName()
                            + "' has been built from the file " + fileName);
                }
                getSynapseConfiguration().addPriorityExecutor(e.getName(), e);

                e.init();

                if (log.isDebugEnabled()) {
                    log.debug("PriorityExecutor Deployment from file : " + fileName + " : Completed");
                }
                log.info("PriorityExecutor named '" + e.getName()
                        + "' has been deployed from file : " + fileName);
                return e.getName();
            } else {
                handleSynapseArtifactDeploymentError("PriorityExecutor Deployment Failed. " +
                        "The artifact described in the file " + fileName +
                        " is not a PriorityExecutor");
            }
View Full Code Here

TOP

Related Classes of org.apache.synapse.commons.executors.PriorityExecutor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.