Search in sources :

Example 1 with NoSuchLoadQueueException

use of com.axway.ats.agent.core.threading.exceptions.NoSuchLoadQueueException in project ats-framework by Axway.

the class MultiThreadedActionHandler method resumeQueue.

public void resumeQueue(String actionQueueName) throws NoSuchLoadQueueException, ActionExecutionException, ActionTaskLoaderException {
    //first cleanup the queues
    cleanupFinishedQueues();
    QueueLoader queueLoader = queueLoadersMap.get(actionQueueName);
    if (queueLoader == null) {
        throw new NoSuchLoadQueueException(actionQueueName);
    }
    //resume the queue
    queueLoader.resume();
}
Also used : QueueLoader(com.axway.ats.agent.core.threading.QueueLoader) AbstractQueueLoader(com.axway.ats.agent.core.threading.AbstractQueueLoader) NoSuchLoadQueueException(com.axway.ats.agent.core.threading.exceptions.NoSuchLoadQueueException)

Example 2 with NoSuchLoadQueueException

use of com.axway.ats.agent.core.threading.exceptions.NoSuchLoadQueueException in project ats-framework by Axway.

the class MultiThreadedActionHandler method startQueue.

/**
     * @param queueName queue name
     * @throws NoSuchLoadQueueException
     * @throws ActionExecutionException
     * @throws ActionTaskLoaderException
     */
public void startQueue(String queueName) throws NoSuchLoadQueueException, ActionExecutionException, ActionTaskLoaderException {
    //first cleanup the queues
    cleanupFinishedQueues();
    QueueLoader queueLoader = queueLoadersMap.get(queueName);
    if (queueLoader == null) {
        throw new NoSuchLoadQueueException(queueName);
    }
    log.info("Starting queue '" + queueName + "'");
    //start the queue
    queueLoader.start();
}
Also used : QueueLoader(com.axway.ats.agent.core.threading.QueueLoader) AbstractQueueLoader(com.axway.ats.agent.core.threading.AbstractQueueLoader) NoSuchLoadQueueException(com.axway.ats.agent.core.threading.exceptions.NoSuchLoadQueueException)

Example 3 with NoSuchLoadQueueException

use of com.axway.ats.agent.core.threading.exceptions.NoSuchLoadQueueException in project ats-framework by Axway.

the class LocalLoadExecutor method executeActions.

@Override
public void executeActions(List<ActionRequest> actionRequests) throws AgentException {
    log.info("Start executing action queue '" + queueName + "'." + (threadingPattern.isBlockUntilCompletion() ? " And wait to finish." : ""));
    // start queue in the database and retrieve its ID
    int queueId = retrieveQueueId(queueSequence, HostUtils.getLocalHostIP());
    try {
        MultiThreadedActionHandler.getInstance(ThreadsPerCaller.getCaller()).executeActions("LOCAL", queueName, queueId, actionRequests, threadingPattern, loaderDataConfig);
        if (threadingPattern.isBlockUntilCompletion()) {
            log.endLoadQueue(queueName, LoadQueueResult.PASSED);
            log.info("Finished executing action queue '" + queueName + "'");
        } else {
            // wait in another thread until the queue finish
            ImportantThread helpThread = new ImportantThread(new Runnable() {

                @Override
                public void run() {
                    try {
                        MultiThreadedActionHandler.getInstance(ThreadsPerCaller.getCaller()).waitUntilQueueFinish(queueName);
                        log.endLoadQueue(queueName, LoadQueueResult.PASSED);
                        log.info("Finished executing action queue '" + queueName + "'");
                    } catch (NoSuchLoadQueueException e) {
                        log.error("Error waiting for action queue '" + queueName + "' completion", e);
                        log.endLoadQueue(queueName, LoadQueueResult.FAILED);
                    }
                }
            });
            helpThread.setDescription(queueName);
            helpThread.start();
            log.info("Action queue '" + queueName + "' scheduled for asynchronous execution");
        }
    } catch (Exception e) {
        throw new AgentException(e.getMessage(), e);
    }
}
Also used : AgentException(com.axway.ats.agent.core.exceptions.AgentException) ImportantThread(com.axway.ats.agent.core.threading.ImportantThread) AgentException(com.axway.ats.agent.core.exceptions.AgentException) NoSuchLoadQueueException(com.axway.ats.agent.core.threading.exceptions.NoSuchLoadQueueException) NoSuchLoadQueueException(com.axway.ats.agent.core.threading.exceptions.NoSuchLoadQueueException)

Aggregations

NoSuchLoadQueueException (com.axway.ats.agent.core.threading.exceptions.NoSuchLoadQueueException)3 AbstractQueueLoader (com.axway.ats.agent.core.threading.AbstractQueueLoader)2 QueueLoader (com.axway.ats.agent.core.threading.QueueLoader)2 AgentException (com.axway.ats.agent.core.exceptions.AgentException)1 ImportantThread (com.axway.ats.agent.core.threading.ImportantThread)1