本文整理汇总了Java中com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException类的典型用法代码示例。如果您正苦于以下问题:Java TaskExecutionException类的具体用法?Java TaskExecutionException怎么用?Java TaskExecutionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TaskExecutionException类属于com.singularity.ee.agent.systemagent.api.exception包,在下文中一共展示了TaskExecutionException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
public static void main(String[] args) throws TaskExecutionException {
ConsoleAppender ca = new ConsoleAppender();
ca.setWriter(new OutputStreamWriter(System.out));
ca.setLayout(new PatternLayout("%-5p [%t]: %m%n"));
ca.setThreshold(Level.TRACE);
logger.getRootLogger().addAppender(ca);
final MarkLogicMonitor monitor = new MarkLogicMonitor();
final Map<String, String> taskArgs = new HashMap<String, String>();
taskArgs.put("config-file", "src/main/resources/conf/config.yml");
taskArgs.put("metrics-file", "src/main/resources/conf/metrics.xml");
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(new Runnable() {
public void run() {
try {
monitor.execute(taskArgs, null);
} catch (Exception e) {
logger.error("Error while running the task", e);
}
}
}, 2, 30, TimeUnit.SECONDS);
}
示例2: main
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
public static void main(String[] args) throws TaskExecutionException {
ConsoleAppender ca = new ConsoleAppender();
ca.setWriter(new OutputStreamWriter(System.out));
ca.setLayout(new PatternLayout("%-5p [%t]: %m%n"));
ca.setThreshold(Level.DEBUG);
logger.getRootLogger().addAppender(ca);
final Map<String, String> taskArgs = new HashMap<String, String>();
taskArgs.put(CONFIG_ARG, "/Users/Muddam/AppDynamics/Code/extensions/kafka-monitoring-extension/src/main/resources/config/config.yml");
final KafkaMonitor monitor = new KafkaMonitor();
//monitor.execute(taskArgs, null);
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(new Runnable() {
public void run() {
try {
monitor.execute(taskArgs, null);
} catch (Exception e) {
logger.error("Error while running the Task ", e);
}
}
}, 2, 60, TimeUnit.SECONDS);
}
示例3: executeProcedure
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
/**
* Executes procedures on VoltDB and returns stats by processing the response from the procedure
*
* @param procedureName
* @param parameter
* @param responseProcessor
* @return
*/
public Map<String, Number> executeProcedure(String procedureName, String parameter, ResponseProcessor responseProcessor) throws TaskExecutionException {
Preconditions.checkArgument(!Strings.isNullOrEmpty(procedureName), "procedureName can not be null");
Preconditions.checkArgument(!Strings.isNullOrEmpty(parameter), "parameter can not be null");
Preconditions.checkArgument(responseProcessor != null, "responseProcessor can not be null");
try {
T response = client.callProcedure(procedureName, parameter);
Map<String, Number> statsMap = null;
if (response instanceof String) {
statsMap = ((JsonResponseProcessor) responseProcessor).parseJson((String) response);
} else if (response instanceof ClientResponse) {
statsMap = ((VoltResponseProcessor) responseProcessor).process((ClientResponse) response);
}
return statsMap;
} catch (Exception e) {
LOG.error("Exception while executing procedure [" + procedureName + "] with parameter [" + parameter + "]", e);
}
return Maps.newHashMap();
}
示例4: callProcedure
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
public String callProcedure(String procedureName, String parameter) throws TaskExecutionException {
String url = getUrl(procedureURL, procedureName, parameter);
if (LOG.isDebugEnabled()) {
LOG.debug("Executing GET request " + url);
}
HttpClient httpClient = HttpClients.createDefault();
HttpGet get = new HttpGet(url);
String resp = null;
try {
resp = execute(httpClient, get);
} catch (IOException e) {
LOG.error("Exception while executing procedure [" + procedureName + "] with parameter [" + parameter + "]", e);
throw new TaskExecutionException("Exception while executing procedure [" + procedureName + "] with parameter [" + parameter + "]", e);
}
return resp;
}
示例5: main
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
public static void main(String[] args) throws TaskExecutionException {
ConsoleAppender ca = new ConsoleAppender();
ca.setWriter(new OutputStreamWriter(System.out));
ca.setLayout(new PatternLayout("%-5p [%t]: %m%n"));
ca.setThreshold(org.apache.log4j.Level.TRACE);
logger.getRootLogger().addAppender(ca);
final ElasticSearchMonitor monitor = new ElasticSearchMonitor();
final Map<String, String> taskArgs = new HashMap<String, String>();
taskArgs.put("config-file", "src/main/resources/conf/config.yml");
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(new Runnable() {
public void run() {
try {
monitor.execute(taskArgs, null);
} catch (Exception e) {
logger.error("Error while running the task", e);
}
}
}, 2, 30, TimeUnit.SECONDS);
}
示例6: execute
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
public TaskOutput execute(Map<String, String> args, TaskExecutionContext taskExecutionContext) throws TaskExecutionException {
String msg = "Using Monitor Version [" + getImplementationVersion() + "]";
logger.info(msg);
logger.info("Starting the Azure ServiceBus Monitoring task.");
try {
if (!initialized) {
initialize(args);
}
configuration.executeTask();
logger.info("Finished Azure ServiceBus monitor execution");
return new TaskOutput("Finished Azure ServiceBus monitor execution");
} catch (Exception e) {
logger.error("Failed to execute the Azure ServiceBus monitoring task", e);
throw new TaskExecutionException("Failed to execute the Azure ServiceBus monitoring task" + e);
}
}
开发者ID:Appdynamics,项目名称:azure-servicebus-monitoring-extension,代码行数:19,代码来源:AzureServiceBusMonitor.java
示例7: execute
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
public TaskOutput execute(Map<String, String> args, TaskExecutionContext taskExecutionContext) throws TaskExecutionException {
String msg = "Using Monitor Version [" + getImplementationVersion() + "]";
logger.info(msg);
logger.info("Starting the Apache Monitoring task.");
Thread thread = Thread.currentThread();
ClassLoader originalCl = thread.getContextClassLoader();
thread.setContextClassLoader(AManagedMonitor.class.getClassLoader());
try {
if (!initialized) {
initialize(args);
}
configuration.executeTask();
logger.info("Finished Apache monitor execution");
return new TaskOutput("Finished Apache monitor execution");
} catch (Exception e) {
logger.error("Failed to execute the Apache monitoring task", e);
throw new TaskExecutionException("Failed to execute the Apache monitoring task" + e);
} finally {
thread.setContextClassLoader(originalCl);
}
}
示例8: execute
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
public TaskOutput execute(Map<String, String> taskArgs, TaskExecutionContext taskExecutionContext)
throws TaskExecutionException {
String msg = "Using Monitor Version [" + getImplementationVersion() + "]";
logger.info(msg);
try{
if (taskArgs != null) {
if (!initialized) {
configure(taskArgs);
}
logger.info("Starting the Linux Monitoring task");
if (logger.isDebugEnabled()) {
logger.debug("The arguments after appending the default values are " + taskArgs);
}
configuration.executeTask();
return new TaskOutput("Linux Monitor Metric Upload Complete");
}
}catch(Exception e) {
logger.error("Failed to execute the Linux monitoring task", e);
}
throw new TaskExecutionException(logVersion() + "Linux monitoring task completed with failures.");
}
示例9: execute
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
/**
* Main execution of the Monitor
*
* @see com.singularity.ee.agent.systemagent.api.ITask#execute(java.util.Map, com.singularity.ee.agent.systemagent.api.TaskExecutionContext)
*/
public TaskOutput execute(Map<String, String> taskArguments, TaskExecutionContext taskExecutionContext) throws TaskExecutionException {
String msg = "Using Monitor Version [" + getImplementationVersion() + "]";
logger.info(msg);
logger.info("Starting the VMWare Monitoring task.");
Thread thread = Thread.currentThread();
ClassLoader originalCl = thread.getContextClassLoader();
thread.setContextClassLoader(AManagedMonitor.class.getClassLoader());
try {
String configFilename = getConfigFilename(taskArguments.get(CONFIG_ARG));
if (!initialized) {
initialize(configFilename);
}
configuration.executeTask();
logger.info("Finished execution");
return new TaskOutput("Finished execution");
} catch (Exception e) {
logger.error("Failed to execute the VMWare monitoring task", e);
throw new TaskExecutionException("Failed to execute the VMWare monitoring task" + e);
} finally {
thread.setContextClassLoader(originalCl);
}
}
示例10: execute
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
public TaskOutput execute(Map<String, String> taskArguments, TaskExecutionContext taskContext)
throws TaskExecutionException {
if(taskArguments != null) {
logger.info("Starting " + getImplementationVersion() + " Monitoring Task");
try {
String configFilename = getConfigFilename(taskArguments.get(CONFIG_ARG));
Configuration config = YmlReader.readFromFile(configFilename, Configuration.class);
fetchMetrics(config, OracleQueries.queries);
printDBMetrics(config);
logger.info("Oracle DB Monitoring Task completed successfully");
return new TaskOutput("Oracle DB Monitoring Task completed successfully");
} catch (Exception e) {
logger.error("Metrics Collection Failed: ", e);
}
}
throw new TaskExecutionException("Oracle DB Monitoring Task completed with failures.");
}
示例11: execute
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
public TaskOutput execute(Map<String, String> taskArgs, TaskExecutionContext taskExecutionContext) throws TaskExecutionException {
logVersion();
if (!initialized) {
initialize(taskArgs);
}
logger.debug("The raw arguments are " + taskArgs);
configuration.executeTask();
logger.info("MarkLogic monitor run completed successfully.");
return new TaskOutput("MarkLogic monitor run completed successfully.");
}
示例12: testMarkLogicMonitor
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
@Test
public void testMarkLogicMonitor() throws TaskExecutionException {
Map<String, String> taskArgs = new HashMap<String, String>();
taskArgs.put("config-file", "src/test/resources/conf/config.yml");
taskArgs.put("metrics-file", "src/test/resources/conf/metrics.xml");
MarkLogicMonitor monitor = new MarkLogicMonitor();
monitor.execute(taskArgs, null);
}
示例13: execute
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
public TaskOutput execute(Map<String, String> taskArgs, TaskExecutionContext out) throws TaskExecutionException {
logVersion();
if (!initialized) {
initialize(taskArgs);
}
logger.debug(String.format("The raw arguments are {}", taskArgs));
configuration.executeTask();
logger.info("Kafka monitor run completed successfully.");
return new TaskOutput("Kafka monitor run completed successfully.");
}
示例14: execute
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
/**
* @param taskArgs
* @param taskExecutionContext
* @return
* @throws TaskExecutionException
*/
public TaskOutput execute(Map<String, String> taskArgs, TaskExecutionContext taskExecutionContext) throws TaskExecutionException {
String voltDBHost = taskArgs.get(VOLTDB_HOST);
String voltDBPort = taskArgs.get(VOLTDB_PORT);
if (Strings.isNullOrEmpty(voltDBHost) || Strings.isNullOrEmpty(voltDBPort)) {
String errorMessage = "null or empty values passed to voltdb-host or voltdb-port";
LOG.error(errorMessage);
throw new TaskExecutionException(errorMessage);
}
String voltDBUser = taskArgs.get(VOLTDB_USER);
String voltDBPassword = taskArgs.get(VOLTDB_PASSWORD);
String modeString = taskArgs.get(MODE);
Mode mode = null;
try {
mode = Mode.get(modeString);
LOG.info("Using " + mode.getMode() + " to get stats");
} catch (EnumConstantNotPresentException e) {
LOG.error("Invalid mode specified. Acepts only restAPI or clientAPI");
throw new TaskExecutionException("Invalid mode specified. Acepts only restAPI or clientAPI");
}
Client<?> client = ClientBuilder.build(mode).getClient(voltDBHost, voltDBPort, voltDBUser, voltDBPassword);
ProcedureExecutor procedureExecutor = new ProcedureExecutor(client);
gatherAndPrintStats(procedureExecutor, mode);
//Release the connection to VoltDb if it is VoltClient. In case of RestClient, when we consume the content the stream is closed.
if (client instanceof VoltClient) {
((VoltClient) client).release();
}
return new TaskOutput("VoltDB monitoring task completed successfully.");
}
示例15: main
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; //导入依赖的package包/类
public static void main(String[] args) throws TaskExecutionException {
Map<String, String> taskArgs = new HashMap<String, String>();
taskArgs.put(VOLTDB_HOST, "localhost");
taskArgs.put(VOLTDB_PORT, "8080");
taskArgs.put(VOLTDB_USER, "admin");
taskArgs.put(VOLTDB_PASSWORD, "voltdb");
//taskArgs.put(MODE, "clientAPI");
taskArgs.put(MODE, "restAPI");
VoltDBMonitor voltDBMonitor = new VoltDBMonitor();
voltDBMonitor.execute(taskArgs, null);
}