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");
}
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");
}
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);
}
}
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;
}
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);
}
}
Aggregations