Search in sources :

Example 6 with AgentException

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

the class ActionQueue method waitUntilQueueFinish.

/**
     * Wait until the specified queue finish
     * 
     * @param queueName
     * @throws AgentException
     */
@PublicAtsApi
public static void waitUntilQueueFinish(String queueName) throws AgentException {
    for (ActionQueue queue : queueInstances) {
        if (queue.name.equals(queueName) && !queue.isQueueFinished) {
            DistributedLoadExecutor distributedLoadExecutor = new DistributedLoadExecutor(queue.name, queue.sequence, new ArrayList<String>(queue.atsAgents), null, null);
            distributedLoadExecutor.waitUntilQueueFinish();
            queue.isQueueFinished = true;
            return;
        }
    }
    throw new AgentException("Queue with name '" + queueName + "' not found");
}
Also used : DistributedLoadExecutor(com.axway.ats.agent.webapp.client.executors.DistributedLoadExecutor) AgentException(com.axway.ats.agent.core.exceptions.AgentException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 7 with AgentException

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

the class ActionQueue method cancelQueue.

/**
     * Cancel a running queue
     * 
     * @param queueName the name of the queue
     * @throws AgentException if no such queue is found
     */
@PublicAtsApi
public static void cancelQueue(String queueName) throws AgentException {
    for (ActionQueue queue : queueInstances) {
        if (queue.name.equals(queueName) && !queue.isQueueFinished) {
            DistributedLoadExecutor distributedLoadExecutor = new DistributedLoadExecutor(queue.name, queue.sequence, new ArrayList<String>(queue.atsAgents), null, null);
            distributedLoadExecutor.cancelAllActions();
            queue.isQueueFinished = true;
            return;
        }
    }
    throw new AgentException("Queue with name '" + queueName + "' not found");
}
Also used : DistributedLoadExecutor(com.axway.ats.agent.webapp.client.executors.DistributedLoadExecutor) AgentException(com.axway.ats.agent.core.exceptions.AgentException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 8 with AgentException

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

the class SystemMonitor method startSystemMonitoringProcess.

private void startSystemMonitoringProcess(String monitoredHost) throws MonitoringException {
    log.debug("Starting the system monitoring process on " + monitoredHost);
    try {
        InternalSystemMonitoringOperations sysMonitoringActions = new InternalSystemMonitoringOperations(monitoredHost);
        sysMonitoringActions.startMonitoring();
    } catch (AgentException e) {
        throw new MonitoringException("Could not start the system monitoring process on " + monitoredHost, e);
    }
}
Also used : InternalSystemMonitoringOperations(com.axway.ats.agent.components.monitoring.operations.clients.InternalSystemMonitoringOperations) AgentException(com.axway.ats.agent.core.exceptions.AgentException) MonitoringException(com.axway.ats.monitoring.model.exceptions.MonitoringException)

Example 9 with AgentException

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

the class SystemMonitor method startMonitoringAgent.

private List<MonitoringException> startMonitoringAgent() {
    List<MonitoringException> errors = new ArrayList<MonitoringException>();
    int numberAgents = 0;
    // iterate the monitored hosts
    Iterator<String> monitoredAgentsIterator = monitoredAgents.iterator();
    while (monitoredAgentsIterator.hasNext()) {
        numberAgents++;
        String monitoredAgent = monitoredAgentsIterator.next();
        log.debug("Starting ATS Agent monitoring on " + monitoredAgent);
        try {
            new AgentMonitoringClient(monitoredAgent).startMonitoring(startTimestamp, pollInterval);
        } catch (AgentException e) {
            errors.add(new MonitoringException("Could not start monitoring ATS Agent " + monitoredAgent, e));
        }
    }
    // Note that we use just 1 task for monitoring all agents
    if (numberAgents > 0 && errors.size() == 0) {
        log.debug("Starting the logging task for the agent monitoring");
        lastUserActivityLoggerTask = new UserActivityLoggerTask(monitoredAgents);
        ScheduledFuture<?> loggerTaskFuture = scheduler.scheduleAtFixedRate(lastUserActivityLoggerTask, loggingInterval, loggingInterval, TimeUnit.SECONDS);
        // put the task in the map
        loggerTasksPerHost.put(UserActivityLoggerTask.ATS_AGENT_HOSTS, loggerTaskFuture);
        log.info("User activity on " + Arrays.toString(monitoredAgents.toArray()) + " agent(s) will be monitored every " + loggingInterval + " seconds");
    }
    return errors;
}
Also used : AgentMonitoringClient(com.axway.ats.agent.webapp.client.AgentMonitoringClient) MonitoringException(com.axway.ats.monitoring.model.exceptions.MonitoringException) AgentException(com.axway.ats.agent.core.exceptions.AgentException) ArrayList(java.util.ArrayList) UserActivityLoggerTask(com.axway.ats.monitoring.model.UserActivityLoggerTask)

Example 10 with AgentException

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

the class SystemMonitor method stopSystemMonitoringProcess.

private void stopSystemMonitoringProcess(String monitoredHost) throws MonitoringException {
    log.debug("Stopping system monitoring on " + monitoredHost);
    try {
        InternalSystemMonitoringOperations sysMonitoringActions = new InternalSystemMonitoringOperations(monitoredHost);
        sysMonitoringActions.stopMonitoring();
        log.debug("Successfully stopped system monitoring on " + monitoredHost);
    } catch (AgentException e) {
        throw new MonitoringException("Could not stop the system monitoring process on " + monitoredHost, e);
    }
}
Also used : InternalSystemMonitoringOperations(com.axway.ats.agent.components.monitoring.operations.clients.InternalSystemMonitoringOperations) AgentException(com.axway.ats.agent.core.exceptions.AgentException) MonitoringException(com.axway.ats.monitoring.model.exceptions.MonitoringException)

Aggregations

AgentException (com.axway.ats.agent.core.exceptions.AgentException)42 IOException (java.io.IOException)16 ArrayList (java.util.ArrayList)11 AgentException_Exception (com.axway.ats.agent.webapp.client.AgentException_Exception)9 AgentService (com.axway.ats.agent.webapp.client.AgentService)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 ObjectOutputStream (java.io.ObjectOutputStream)7 NoSuchComponentException (com.axway.ats.agent.core.exceptions.NoSuchComponentException)6 InternalComponentException (com.axway.ats.agent.webapp.client.InternalComponentException)6 InternalComponentException_Exception (com.axway.ats.agent.webapp.client.InternalComponentException_Exception)6 ActionExecutionException (com.axway.ats.agent.core.exceptions.ActionExecutionException)5 InternalComponentException (com.axway.ats.agent.core.exceptions.InternalComponentException)5 NoCompatibleMethodFoundException (com.axway.ats.agent.core.exceptions.NoCompatibleMethodFoundException)5 NoSuchActionException (com.axway.ats.agent.core.exceptions.NoSuchActionException)5 MonitoringException (com.axway.ats.monitoring.model.exceptions.MonitoringException)5 ByteArrayInputStream (java.io.ByteArrayInputStream)5 ObjectInputStream (java.io.ObjectInputStream)5 WebMethod (javax.jws.WebMethod)5 DatabaseEnvironmentUnit (com.axway.ats.environment.database.DatabaseEnvironmentUnit)4 File (java.io.File)4