GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.voltactivedata.com — Chapter 9. Creating Custom Tasks Guide to Performance and CustomizationChapter 9. Creating Custom TasksYou can schedule common repetitive tasks using the CREATE TASK SQL statement. CREATE TASK lets you schedule any system or user-defined stored procedure to be run on a specified schedule. However, there are times when you need the schedule, or the procedure itself, to be more responsive: adjusting to the current state of the database or the results of the previous task runs. This is what custom tasks help you accomplish. Custom tasks let you modify the characteristics of the task, including:
The following sections describe how to design, develop and implement custom tasks. 9.1. Overview of How Custom Tasks WorkYou write custom tasks as Java classes implementing one of three interfaces, depending on what you want to customize:
Once you write the class for a custom task, you implement it in VoltDB in two steps:
For example, the following SQL statements declare one custom task of each type, assuming their classes are packaged in
the JAR LOAD CLASSES mytasks.jar; CREATE TASK variableproc ON SCHEDULE EVERY 5 SECONDS PROCEDURE FROM CLASS MyVariableProc WITH (1,2,3); CREATE TASK variableinterval ON SCHEDULE FROM CLASS MyVariableInterval WITH (1,2,3) PROCEDURE cleanupchoir; CREATE TASK variabletask FROM CLASS MyVariableTask WITH (1,2,3); In all three cases, the sequence of events at run time is the same. Once you declare and enable a custom task, the database:
This sequence of events is repeated any time the database is restarted, the schema is changed, or the database is paused and then resumed. The following sections provide examples of using each type of customization. See the javadoc for additional details about the classes and methods that can assist your task design. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |