Class DatabaseQueryScheduledTask

java.lang.Object
com.orchestranetworks.scheduler.ScheduledTask
com.apgar.common.lib.scheduledtask.DatabaseQueryScheduledTask

public class DatabaseQueryScheduledTask extends ScheduledTask
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 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

      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:
      execute in class ScheduledTask
      Parameters:
      context - the scheduled execution context
      Throws:
      OperationException - if an EBX-specific operation fails
      ScheduledTaskInterruption - if the task execution is interrupted