Class DatabaseQueryScheduledTask
java.lang.Object
com.orchestranetworks.scheduler.ScheduledTask
com.apgar.common.lib.scheduledtask.DatabaseQueryScheduledTask
A scheduled task that executes a simple database query multiple times to measure performance and verify connectivity.
This task connects to the database using environment variables defined in EnvironmentVariablesConstants, runs a
SELECT * FROM EBX_REP query for the configured number of iterations, and logs execution details and timing.
To utilize this functionality, create a task in the Tasks table of the Task Scheduler under the Administration tab with the following specifications:
- Module: The module that contains this JAR file.
- Class Name: com.apgar.common.lib.scheduledtask.DatabaseQueryScheduledTask
- Parameters:
- requestCount: Specifies the number of times to execute the query.
- Author:
- APGAR Consulting
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(ScheduledExecutionContext context) Executes the scheduled task.intGets the number of times the query will be executed.voidsetRequestCount(int requestCount) Sets the number of times the query should be executed.Methods inherited from class com.orchestranetworks.scheduler.ScheduledTask
handleBeforeInterrupting, handleBeforePausing, handleBeforeResuming, isInterruptable, isPausable, validate, zza, zza, zza, zzb, zzb, zzc, zzd
-
Constructor Details
-
DatabaseQueryScheduledTask
public DatabaseQueryScheduledTask()
-
-
Method Details
-
getRequestCount
public int getRequestCount()Gets the number of times the query will be executed.- Returns:
- the request count
-
setRequestCount
public void setRequestCount(int requestCount) Sets the number of times the query should be executed.- Parameters:
requestCount- the number of queries to execute
-
execute
public void execute(ScheduledExecutionContext context) throws OperationException, ScheduledTaskInterruption Executes the scheduled task.Establishes a database connection using credentials from environment variables, logs execution parameters, and runs the configured query multiple times. Any errors are logged at
Level.SEVERE.- Specified by:
executein classScheduledTask- Parameters:
context- the scheduled execution context- Throws:
OperationException- if an EBX-specific operation failsScheduledTaskInterruption- if the task execution is interrupted
-