libquartz-java-1.7.3.orig/ 0000755 0001750 0001750 00000000000 11623033643 015354 5 ustar twerner twerner libquartz-java-1.7.3.orig/QuartzQuickStart.html 0000644 0001750 0001750 00000000720 11336604270 021543 0 ustar twerner twerner
Quartz Quickstart
libquartz-java-1.7.3.orig/quartz-all/ 0000755 0001750 0001750 00000000000 11623033643 017450 5 ustar twerner twerner libquartz-java-1.7.3.orig/quartz-all/pom.xml 0000644 0001750 0001750 00000003046 11341050475 020767 0 ustar twerner twerner
4.0.0
org.quartz-scheduler
quartz-parent
1.7.3
quartz-all
Quartz Enterprise Job Scheduler - Complete bundle
maven-antrun-plugin
packing-all
process-sources
run
maven-deploy-plugin
true
libquartz-java-1.7.3.orig/examples/ 0000755 0001750 0001750 00000000000 11623033644 017173 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/example8/ 0000755 0001750 0001750 00000000000 11623033643 020715 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/example8/example8.sh 0000755 0001750 0001750 00000000637 11332420531 022776 0 ustar twerner twerner #!/bin/sh
# Change this to your JDK installation root
#
#JAVA_HOME=/usr/java/j2sdk1.4.0_01
JRE=$JAVA_HOME/jre
JAVA=$JRE/bin/java
QUARTZ=../..
. ${QUARTZ}/examples/bin/buildcp.sh
# Uncomment the following line if you would like to set log4j
# logging properties
#
#LOGGING_PROPS="-Dlog4j.configuration=log4j.properties"
$JAVA -classpath $QUARTZ_CP $LOGGING_PROPS org.quartz.examples.example8.CalendarExample
libquartz-java-1.7.3.orig/examples/example8/log4j.xml 0000755 0001750 0001750 00000001165 10276303016 022461 0 ustar twerner twerner
libquartz-java-1.7.3.orig/examples/example8/example8.bat 0000644 0001750 0001750 00000001207 10265024000 023114 0 ustar twerner twerner @echo off
rem Set Quartz to the base directory of the Quartz Distribution
@SET QUARTZ=..\..
@rem setup the class path...
CALL ..\bin\buildcp.bat
SET QUARTZ_CP=%TMP_CP%
rem !!!!!!! Please read important information. !!!!!!
rem If "java" is not in your path, please set the path
rem for Java 2 Runtime Environment in the path variable below
rem for example :
rem @SET PATH=D:\jdk1.3.1;%PATH%
rem
rem Set LOG4J props if you are interested in setting up
rem a configuraiton file for log4j logging
rem @SET LOG4J_PROPS="-Dlog4j.configuration=log4j.properties"
"java" -cp "%QUARTZ_CP%" %LOG4J_PROPS% org.quartz.examples.example8.CalendarExample
libquartz-java-1.7.3.orig/examples/example8/calendars_readme.txt 0000644 0001750 0001750 00000000761 10265024000 024717 0 ustar twerner twerner Example 8
=========
Overview:
=========
This example will demonstrate how to use Calendars in Quartz.
Running the Example:
====================
1. Windows users - Modify the example8.bat file (if necessary)
to set your JAVA_HOME. Run example8.bat
2. UNIX/Linux users - Modify the example8.sh file (if necessary)
to set your JAVA_HOME. Execute example8.sh
Configuration Files:
====================
1. You can decide to specify a log4j.properties file to
control logging output (optional)
libquartz-java-1.7.3.orig/examples/examples_guide.txt 0000644 0001750 0001750 00000001735 10470377512 022741 0 ustar twerner twerner Welcome
=======
Welcome to the Quartz Examples directory.
This directory contains 14 examples that show you how to use various
features of Quartz. Each example is located in its own subdirectory.
Every example can be run using Windows .bat files or Linux/UNIX .sh files.
Additionally, each example directory contains a readme.txt file. Please
read this file first, as it will contain useful information for running
the examples.
Examples Listing
================
example1 - Your first Quartz Program
example2 - Simple Job Triggers
example3 - Cron Triggers
example4 - Job State and Job Parameters
example5 - Job Misfires
example6 - Handling Job Exceptions
example7 - Interrupting Jobs
example8 - How to use Quartz Calendars
example9 - Using Job Listeners
example10 - Using Quartz Plug-Ins
example11 - Loading Up Quartz with Many Jobs
example12 - Remoting with Quartz using RMI
example13 - Clustering Quartz and JDBC Job Stores
example14 - Quartz Trigger Priorities
libquartz-java-1.7.3.orig/examples/bin/ 0000755 0001750 0001750 00000000000 11623033644 017743 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/bin/readme.txt 0000644 0001750 0001750 00000000347 10265022244 021740 0 ustar twerner twerner
This directory contains scripts that are used to support running the examples,
but are not meant to be directly ran by the user.
Look in the individual example directories for a script related to running the
particular example.
libquartz-java-1.7.3.orig/examples/bin/buildcp.sh 0000755 0001750 0001750 00000001012 11304646746 021727 0 ustar twerner twerner #!/bin/sh
# You May Need To Change this to your Quartz installation root
QUARTZ=../..
QUARTZ_CP=""
for jarfile in $QUARTZ/*.jar; do
QUARTZ_CP=$QUARTZ_CP:$jarfile
done
for jarfile in $QUARTZ/examples/*.jar; do
QUARTZ_CP=$QUARTZ_CP:$jarfile
done
for jarfile in $QUARTZ/build/*.jar; do
QUARTZ_CP=$QUARTZ_CP:$jarfile
done
for jarfile in $QUARTZ/examples/build/*.jar; do
QUARTZ_CP=$QUARTZ_CP:$jarfile
done
for jarfile in $QUARTZ/lib/*.jar; do
QUARTZ_CP=$QUARTZ_CP:$jarfile
done
echo "Classpath: " $QUARTZ_CP
libquartz-java-1.7.3.orig/examples/bin/buildcp.bat 0000644 0001750 0001750 00000001346 11332420531 022051 0 ustar twerner twerner @echo off
IF "%QUARTZ%"=="" SET QUARTZ=..\..
SET QEB=%QUARTZ%\examples\bin
SET TMP_CP=.
dir /b "%QUARTZ%\*.jar" > temp.tmp
FOR /F %%I IN (temp.tmp) DO CALL "%QEB%\addpath.bat" "%QUARTZ%\%%I"
dir /b "%QUARTZ%\examples\*.jar" > temp.tmp
FOR /F %%I IN (temp.tmp) DO CALL "%QEB%\addpath.bat" "%QUARTZ%\examples\%%I"
dir /b "%QUARTZ%\*.jar" > temp.tmp
FOR /F %%I IN (temp.tmp) DO CALL "%QEB%\addpath.bat" "%QUARTZ%\build\%%I"
dir /b "%QUARTZ%\examples\*.jar" > temp.tmp
FOR /F %%I IN (temp.tmp) DO CALL "%QEB%\addpath.bat" "%QUARTZ%\examples\build\%%I"
dir /b "%QUARTZ%\lib\*.jar" > temp.tmp
FOR /F %%I IN (temp.tmp) DO CALL "%QEB%\addpath.bat" "%QUARTZ%\lib\%%I"
DEL temp.tmp
IF NOT "%CLASSPATH%"=="" SET TMP_CP=%TMP_CP%;"%CLASSPATH%"
libquartz-java-1.7.3.orig/examples/bin/addpath.bat 0000644 0001750 0001750 00000000027 10265022244 022032 0 ustar twerner twerner set TMP_CP=%TMP_CP%;%1
libquartz-java-1.7.3.orig/examples/example12/ 0000755 0001750 0001750 00000000000 11623033644 020771 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/example12/client.sh 0000755 0001750 0001750 00000001046 11332420531 022577 0 ustar twerner twerner #!/bin/sh
# Change this to your JDK installation root
#
#JAVA_HOME=/usr/java/j2sdk1.4.0_01
JRE=$JAVA_HOME/jre
JAVA=$JRE/bin/java
QUARTZ=../..
. ${QUARTZ}/examples/bin/buildcp.sh
# Uncomment the following line if you would like to set log4j
# logging properties
#
#LOGGING_PROPS="-Dlog4j.configuration=log4j.properties"
# Set the name and location of the client.properties file
QUARTZ_PROPS="-Dorg.quartz.properties=client.properties"
$JAVA -classpath $QUARTZ_CP $QUARTZ_PROPS $LOGGING_PROPS org.quartz.examples.example12.RemoteClientExample
libquartz-java-1.7.3.orig/examples/example12/rmi_readme.txt 0000644 0001750 0001750 00000004321 10265024000 023621 0 ustar twerner twerner Example 12
==========
Overview:
=========
This example demonstrates how Quartz can be used in a client/server
environment to remotely scheudle jobs on a remote server using
RMI (Remote Method Invocation).
This example will run a server that will execute the scheudle. The
server itself will not schedule any jobs. This example will also
execute a client that will connect to the server (via RMI) to
schedule the job. Once the job is remotely scheduled, the sceduler on
the server will run the job (at the correct time).
Note: This example works best when you run the client and server on
different computers. However, you can certainly run the server and
the client on the same box!
Running the Example:
====================
1. Configure the client.properties file and the server.properties
as necesarry (see the "Configuration" section below for details).
2. Windows users - Modify server.bat and client.bat (if necessary)
to set your JAVA_HOME. Run server.bat. Once the server is started, run
client.bat (note: these may or may not be on the same box!)
3. UNIX/Linux users - Modify server.sh and client.sh (if necessary)
to set your JAVA_HOME. Execute server.sh. Once the server is started,
run client.sh (note: these may or may not be on the same box!)
Note: If you have access to both Windows boxes and UNIX/Linux boxes, try
running the example on different platforms!
Configuration:
==============
1. You can decide to specify a log4j.properties file to
control logging output (optional)
2. There is a server.properties file that is used to
configure the server and the host and port that the server
is listening to for RMI request. Typically, this host is
localhost and the port is 1099:
org.quartz.scheduler.rmi.registryHost = localhost
org.quartz.scheduler.rmi.registryPort = 1099
3. There is a client.properties file that is used to configure
the client to tell it which server and port to connect to. If the
client is running on the same box as the server, then localhost will
be fine. If server is running on a different box than the client, then
you will want to specify the host or IP address for registryHost. This
will tell the client which server/host to connect to for its remote
method invokations. libquartz-java-1.7.3.orig/examples/example12/server.properties 0000644 0001750 0001750 00000002010 10265024000 024371 0 ustar twerner twerner #============================================================================
# Configure Main Scheduler Properties
#============================================================================
org.quartz.scheduler.instanceName = Sched1
org.quartz.scheduler.rmi.export = true
org.quartz.scheduler.rmi.registryHost = localhost
org.quartz.scheduler.rmi.registryPort = 1099
org.quartz.scheduler.rmi.createRegistry = true
#============================================================================
# Configure ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10
org.quartz.threadPool.threadPriority = 5
#============================================================================
# Configure JobStore
#============================================================================
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
libquartz-java-1.7.3.orig/examples/example12/log4j.xml 0000755 0001750 0001750 00000001165 10276303016 022534 0 ustar twerner twerner
libquartz-java-1.7.3.orig/examples/example12/client.bat 0000644 0001750 0001750 00000001426 10265024000 022725 0 ustar twerner twerner @echo off
rem Set Quartz to the base directory of the Quartz Distribution
@SET QUARTZ=..\..
@rem setup the class path...
CALL ..\bin\buildcp.bat
SET QUARTZ_CP=%TMP_CP%
rem !!!!!!! Please read important information. !!!!!!
rem If "java" is not in your path, please set the path
rem for Java 2 Runtime Environment in the path variable below
rem for example :
rem @SET PATH=D:\jdk1.3.1;%PATH%
rem
rem Set LOG4J props if you are interested in setting up
rem a configuraiton file for log4j logging
rem @SET LOG4J_PROPS="-Dlog4j.configuration=log4j.properties"
rem Set the location and name of the quartz.properties file
@SET QUARTZ_PROPS="-Dorg.quartz.properties=client.properties"
"java" -cp "%QUARTZ_CP%" %QUARTZ_PROPS% %LOG4J_PROPS% org.quartz.examples.example12.RemoteClientExample
libquartz-java-1.7.3.orig/examples/example12/rmi.policy 0000644 0001750 0001750 00000000065 10265024000 022765 0 ustar twerner twerner grant {
permission java.security.AllPermission;
};
libquartz-java-1.7.3.orig/examples/example12/client.properties 0000644 0001750 0001750 00000000606 10265024000 024352 0 ustar twerner twerner # Properties file for use by StdSchedulerFactory
# to create a Quartz Scheduler Instance.
#
# Configure Main Scheduler Properties ======================================
org.quartz.scheduler.instanceName = Sched1
org.quartz.scheduler.logger = schedLogger
org.quartz.scheduler.rmi.proxy = true
org.quartz.scheduler.rmi.registryHost = localhost
org.quartz.scheduler.rmi.registryPort = 1099
libquartz-java-1.7.3.orig/examples/example12/server.bat 0000644 0001750 0001750 00000001426 10265024000 022755 0 ustar twerner twerner @echo off
rem Set Quartz to the base directory of the Quartz Distribution
@SET QUARTZ=..\..
@rem setup the class path...
CALL ..\bin\buildcp.bat
SET QUARTZ_CP=%TMP_CP%
rem !!!!!!! Please read important information. !!!!!!
rem If "java" is not in your path, please set the path
rem for Java 2 Runtime Environment in the path variable below
rem for example :
rem @SET PATH=D:\jdk1.3.1;%PATH%
rem
rem Set LOG4J props if you are interested in setting up
rem a configuraiton file for log4j logging
rem @SET LOG4J_PROPS="-Dlog4j.configuration=log4j.properties"
rem Set the location and name of the quartz.properties file
@SET QUARTZ_PROPS="-Dorg.quartz.properties=server.properties"
"java" -cp "%QUARTZ_CP%" %QUARTZ_PROPS% %LOG4J_PROPS% org.quartz.examples.example12.RemoteServerExample
libquartz-java-1.7.3.orig/examples/example12/server.sh 0000755 0001750 0001750 00000001046 11332420531 022627 0 ustar twerner twerner #!/bin/sh
# Change this to your JDK installation root
#
#JAVA_HOME=/usr/java/j2sdk1.4.0_01
JRE=$JAVA_HOME/jre
JAVA=$JRE/bin/java
QUARTZ=../..
. ${QUARTZ}/examples/bin/buildcp.sh
# Uncomment the following line if you would like to set log4j
# logging properties
#
#LOGGING_PROPS="-Dlog4j.configuration=log4j.properties"
# Set the name and location of the quartz.properties file
QUARTZ_PROPS="-Dorg.quartz.properties=server.properties"
$JAVA -classpath $QUARTZ_CP $QUARTZ_PROPS $LOGGING_PROPS org.quartz.examples.example12.RemoteServerExample
libquartz-java-1.7.3.orig/examples/example11/ 0000755 0001750 0001750 00000000000 11623033644 020770 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/example11/log4j.xml 0000755 0001750 0001750 00000001165 10276303016 022533 0 ustar twerner twerner
libquartz-java-1.7.3.orig/examples/example11/quartz.properties 0000644 0001750 0001750 00000003176 10265024000 024426 0 ustar twerner twerner
#============================================================================
# Configure Main Scheduler Properties
#============================================================================
org.quartz.scheduler.instanceName = TestScheduler
org.quartz.scheduler.instanceId = AUTO
#============================================================================
# Configure ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 12
org.quartz.threadPool.threadPriority = 5
#============================================================================
# Configure JobStore
#============================================================================
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
#org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
#org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
#org.quartz.jobStore.useProperties = false
#org.quartz.jobStore.dataSource = myDS
#org.quartz.jobStore.tablePrefix = QRTZ_
#org.quartz.jobStore.isClustered = false
#============================================================================
# Configure Datasources
#============================================================================
#org.quartz.dataSource.myDS.driver = org.postgresql.Driver
#org.quartz.dataSource.myDS.URL = jdbc:postgresql://localhost/dev
#org.quartz.dataSource.myDS.user = jhouse
#org.quartz.dataSource.myDS.password =
#org.quartz.dataSource.myDS.maxConnections = 5
libquartz-java-1.7.3.orig/examples/example11/example11.sh 0000755 0001750 0001750 00000001042 11332420531 023111 0 ustar twerner twerner #!/bin/sh
# Change this to your JDK installation root
#
#JAVA_HOME=/usr/java/j2sdk1.4.0_01
JRE=$JAVA_HOME/jre
JAVA=$JRE/bin/java
QUARTZ=../..
. ${QUARTZ}/examples/bin/buildcp.sh
# Uncomment the following line if you would like to set log4j
# logging properties
#
#LOGGING_PROPS="-Dlog4j.configuration=log4j.properties"
# Set the name and location of the quartz.properties file
QUARTZ_PROPS="-Dorg.quartz.properties=quartz.properties"
$JAVA -classpath $QUARTZ_CP $QUARTZ_PROPS $LOGGING_PROPS org.quartz.examples.example11.LoadExample 500
libquartz-java-1.7.3.orig/examples/example11/high_load_readme.txt 0000644 0001750 0001750 00000002246 11000462603 024756 0 ustar twerner twerner Example 11
==========
Overview:
=========
This example demonstrates how Quartz can handle a large
number of jobs. This example starts with 500 jobs. However,
this number can be changed by modifying the start scripts.
Due to the size of the thread pool (this example uses as thread
count of 12), only 12 threads will run concurrently in the
scheduler.
You can change this parameter in the quartz.properties file.
Running the Example:
====================
1. Windows users - Modify the example11.bat file (if necessary)
to set your JAVA_HOME. Run example11.bat
2. UNIX/Linux users - Modify the example11.sh file (if necessary)
to set your JAVA_HOME. Execute example11.sh
Configuration:
==============
1. You can decide to specify a log4j.properties file to
control logging output (optional)
2. This example uses the quartz.properties file to
configure quartz. Modify the "threadCount" property to
control how many threads are in the Quartz thread pool
(this limits the number of jobs that can execute at the
same time)
3. You can also modify the number of jobs that are run
in this example. Simply edit the script and pass in a valid
number into the program.
libquartz-java-1.7.3.orig/examples/example11/example11.bat 0000644 0001750 0001750 00000001421 10265024000 023236 0 ustar twerner twerner @echo off
rem Set Quartz to the base directory of the Quartz Distribution
@SET QUARTZ=..\..
@rem setup the class path...
CALL ..\bin\buildcp.bat
SET QUARTZ_CP=%TMP_CP%
rem !!!!!!! Please read important information. !!!!!!
rem If "java" is not in your path, please set the path
rem for Java 2 Runtime Environment in the path variable below
rem for example :
rem @SET PATH=D:\jdk1.3.1;%PATH%
rem
rem Set LOG4J props if you are interested in setting up
rem a configuraiton file for log4j logging
rem @SET LOG4J_PROPS="-Dlog4j.configuration=log4j.properties"
rem Set the location and name of the quartz.properties file
@SET QUARTZ_PROPS="-Dorg.quartz.properties=quartz.properties"
"java" -cp "%QUARTZ_CP%" %QUARTZ_PROPS% %LOG4J_PROPS% org.quartz.examples.example11.LoadExample 500
libquartz-java-1.7.3.orig/examples/pom.xml 0000644 0001750 0001750 00000001622 11341050475 020507 0 ustar twerner twerner
4.0.0
org.quartz-scheduler
quartz-parent
1.7.3
quartz-examples
jar
Quartz Example Applications
org.quartz-scheduler
quartz
maven-deploy-plugin
true
libquartz-java-1.7.3.orig/examples/example9/ 0000755 0001750 0001750 00000000000 11623033643 020716 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/example9/log4j.xml 0000755 0001750 0001750 00000001165 10276303016 022462 0 ustar twerner twerner
libquartz-java-1.7.3.orig/examples/example9/example9.bat 0000644 0001750 0001750 00000001207 10265024000 023116 0 ustar twerner twerner @echo off
rem Set Quartz to the base directory of the Quartz Distribution
@SET QUARTZ=..\..
@rem setup the class path...
CALL ..\bin\buildcp.bat
SET QUARTZ_CP=%TMP_CP%
rem !!!!!!! Please read important information. !!!!!!
rem If "java" is not in your path, please set the path
rem for Java 2 Runtime Environment in the path variable below
rem for example :
rem @SET PATH=D:\jdk1.3.1;%PATH%
rem
rem Set LOG4J props if you are interested in setting up
rem a configuraiton file for log4j logging
rem @SET LOG4J_PROPS="-Dlog4j.configuration=log4j.properties"
"java" -cp "%QUARTZ_CP%" %LOG4J_PROPS% org.quartz.examples.example9.ListenerExample
libquartz-java-1.7.3.orig/examples/example9/example9.sh 0000755 0001750 0001750 00000000637 11332420531 023000 0 ustar twerner twerner #!/bin/sh
# Change this to your JDK installation root
#
#JAVA_HOME=/usr/java/j2sdk1.4.0_01
JRE=$JAVA_HOME/jre
JAVA=$JRE/bin/java
QUARTZ=../..
. ${QUARTZ}/examples/bin/buildcp.sh
# Uncomment the following line if you would like to set log4j
# logging properties
#
#LOGGING_PROPS="-Dlog4j.configuration=log4j.properties"
$JAVA -classpath $QUARTZ_CP $LOGGING_PROPS org.quartz.examples.example9.ListenerExample
libquartz-java-1.7.3.orig/examples/example9/listeners_readme.txt 0000644 0001750 0001750 00000001047 10265024000 024772 0 ustar twerner twerner Example 9
=========
Overview:
=========
This example demonstrates how to use Job Listeners in
Quartz to have the completion of one job trigger another job.
Running the Example:
====================
1. Windows users - Modify the example9.bat file (if necessary)
to set your JAVA_HOME. Run example9.bat
2. UNIX/Linux users - Modify the example9.sh file (if necessary)
to set your JAVA_HOME. Execute example9.sh
Configuration Files:
====================
1. You can decide to specify a log4j.properties file to
control logging output (optional)
libquartz-java-1.7.3.orig/examples/example5/ 0000755 0001750 0001750 00000000000 11623033643 020712 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/example5/log4j.xml 0000755 0001750 0001750 00000001165 10276303016 022456 0 ustar twerner twerner
libquartz-java-1.7.3.orig/examples/example5/example5.bat 0000644 0001750 0001750 00000001206 10265024000 023105 0 ustar twerner twerner @echo off
rem Set Quartz to the base directory of the Quartz Distribution
@SET QUARTZ=..\..
@rem setup the class path...
CALL ..\bin\buildcp.bat
SET QUARTZ_CP=%TMP_CP%
rem !!!!!!! Please read important information. !!!!!!
rem If "java" is not in your path, please set the path
rem for Java 2 Runtime Environment in the path variable below
rem for example :
rem @SET PATH=D:\jdk1.3.1;%PATH%
rem
rem Set LOG4J props if you are interested in setting up
rem a configuraiton file for log4j logging
rem @SET LOG4J_PROPS="-Dlog4j.configuration=log4j.properties"
"java" -cp "%QUARTZ_CP%" %LOG4J_PROPS% org.quartz.examples.example5.MisfireExample
libquartz-java-1.7.3.orig/examples/example5/example5.sh 0000755 0001750 0001750 00000000636 11332420531 022767 0 ustar twerner twerner #!/bin/sh
# Change this to your JDK installation root
#
#JAVA_HOME=/usr/java/j2sdk1.4.0_01
JRE=$JAVA_HOME/jre
JAVA=$JRE/bin/java
QUARTZ=../..
. ${QUARTZ}/examples/bin/buildcp.sh
# Uncomment the following line if you would like to set log4j
# logging properties
#
#LOGGING_PROPS="-Dlog4j.configuration=log4j.properties"
$JAVA -classpath $QUARTZ_CP $LOGGING_PROPS org.quartz.examples.example5.MisfireExample
libquartz-java-1.7.3.orig/examples/example5/misfires_readme.txt 0000644 0001750 0001750 00000000750 10265024000 024577 0 ustar twerner twerner Example 5
=========
Overview:
=========
This example will demonstrate how job misfires work.
Running the Example:
====================
1. Windows users - Modify the example5.bat file (if necessary)
to set your JAVA_HOME. Run example5.bat
2. UNIX/Linux users - Modify the example5.sh file (if necessary)
to set your JAVA_HOME. Execute example5.sh
Configuration Files:
====================
1. You can decide to specify a log4j.properties file to
control logging output (optional)
libquartz-java-1.7.3.orig/examples/example6/ 0000755 0001750 0001750 00000000000 11623033643 020713 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/example6/example6.bat 0000644 0001750 0001750 00000001213 10265024000 023105 0 ustar twerner twerner @echo off
rem Set Quartz to the base directory of the Quartz Distribution
@SET QUARTZ=..\..
@rem setup the class path...
CALL ..\bin\buildcp.bat
SET QUARTZ_CP=%TMP_CP%
rem !!!!!!! Please read important information. !!!!!!
rem If "java" is not in your path, please set the path
rem for Java 2 Runtime Environment in the path variable below
rem for example :
rem @SET PATH=D:\jdk1.3.1;%PATH%
rem
rem Set LOG4J props if you are interested in setting up
rem a configuraiton file for log4j logging
rem @SET LOG4J_PROPS="-Dlog4j.configuration=log4j.properties"
"java" -cp "%QUARTZ_CP%" %LOG4J_PROPS% org.quartz.examples.example6.JobExceptionExample
libquartz-java-1.7.3.orig/examples/example6/exceptions_readme.txt 0000644 0001750 0001750 00000000752 10265024000 025142 0 ustar twerner twerner Example 6
=========
Overview:
=========
This example will demonstrate how job exceptions work.
Running the Example:
====================
1. Windows users - Modify the example6.bat file (if necessary)
to set your JAVA_HOME. Run example6.bat
2. UNIX/Linux users - Modify the example6.sh file (if necessary)
to set your JAVA_HOME. Execute example6.sh
Configuration Files:
====================
1. You can decide to specify a log4j.properties file to
control logging output (optional)
libquartz-java-1.7.3.orig/examples/example6/log4j.xml 0000755 0001750 0001750 00000001165 10276303016 022457 0 ustar twerner twerner
libquartz-java-1.7.3.orig/examples/example6/example6.sh 0000755 0001750 0001750 00000000643 11332420531 022767 0 ustar twerner twerner #!/bin/sh
# Change this to your JDK installation root
#
#JAVA_HOME=/usr/java/j2sdk1.4.0_01
JRE=$JAVA_HOME/jre
JAVA=$JRE/bin/java
QUARTZ=../..
. ${QUARTZ}/examples/bin/buildcp.sh
# Uncomment the following line if you would like to set log4j
# logging properties
#
#LOGGING_PROPS="-Dlog4j.configuration=log4j.properties"
$JAVA -classpath $QUARTZ_CP $LOGGING_PROPS org.quartz.examples.example6.JobExceptionExample
libquartz-java-1.7.3.orig/examples/src/ 0000755 0001750 0001750 00000000000 11623033643 017761 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/ 0000755 0001750 0001750 00000000000 11623033644 020706 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/resources/ 0000755 0001750 0001750 00000000000 11623033644 022720 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/resources/org/ 0000755 0001750 0001750 00000000000 11623033644 023507 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/resources/org/quartz/ 0000755 0001750 0001750 00000000000 11623033644 025035 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/resources/org/quartz/examples/ 0000755 0001750 0001750 00000000000 11623033644 026653 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/resources/org/quartz/examples/example14/ 0000755 0001750 0001750 00000000000 11623033644 030453 5 ustar twerner twerner ././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root libquartz-java-1.7.3.orig/examples/src/main/resources/org/quartz/examples/example14/quartz_priority.properties libquartz-java-1.7.3.orig/examples/src/main/resources/org/quartz/examples/example14/quartz_priority.0000644 0001750 0001750 00000000475 11301602613 033740 0 ustar twerner twerner org.quartz.scheduler.instanceName=PriorityExampleScheduler
# Set thread count to 1 to force Triggers scheduled for the same time to
# to be ordered by priority.
org.quartz.threadPool.threadCount=1
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore
libquartz-java-1.7.3.orig/examples/src/main/java/ 0000755 0001750 0001750 00000000000 11623033643 021626 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/ 0000755 0001750 0001750 00000000000 11623033643 022415 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/ 0000755 0001750 0001750 00000000000 11623033643 023743 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/ 0000755 0001750 0001750 00000000000 11623033644 025562 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example8/ 0000755 0001750 0001750 00000000000 11623033644 027305 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example8/CalendarExample.java 0000644 0001750 0001750 00000011004 11302141051 033153 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example8;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SchedulerMetaData;
import org.quartz.SimpleTrigger;
import org.quartz.examples.example2.SimpleJob;
import org.quartz.TriggerUtils;
import org.quartz.impl.StdSchedulerFactory;
import org.quartz.impl.calendar.AnnualCalendar;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
/**
* This example will demonstrate how calendars can be used
* to exclude periods of time when scheduling should not
* take place.
*
*/
public class CalendarExample {
public void run() throws Exception {
final Log log = LogFactory.getLog(CalendarExample.class);
log.info("------- Initializing ----------------------");
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
log.info("------- Initialization Complete -----------");
log.info("------- Scheduling Jobs -------------------");
// Add the holiday calendar to the schedule
AnnualCalendar holidays = new AnnualCalendar();
// fourth of July (July 4)
Calendar fourthOfJuly = new GregorianCalendar(2005, 6, 4);
holidays.setDayExcluded(fourthOfJuly, true);
// halloween (Oct 31)
Calendar halloween = new GregorianCalendar(2005, 9, 31);
holidays.setDayExcluded(halloween, true);
// christmas (Dec 25)
Calendar christmas = new GregorianCalendar(2005, 11, 25);
holidays.setDayExcluded(christmas, true);
// tell the schedule about our holiday calendar
sched.addCalendar("holidays", holidays, false, false);
// schedule a job to run hourly, starting on halloween
// at 10 am
Date runDate = TriggerUtils.getDateOf(0,0, 10, 31, 10);
JobDetail job = new JobDetail("job1", "group1", SimpleJob.class);
SimpleTrigger trigger = new SimpleTrigger("trigger1", "group1",
runDate,
null,
SimpleTrigger.REPEAT_INDEFINITELY,
60L * 60L * 1000L);
// tell the trigger to obey the Holidays calendar!
trigger.setCalendarName("holidays");
// schedule the job and print the first run date
Date firstRunTime = sched.scheduleJob(job, trigger);
// print out the first execution date.
// Note: Since Halloween (Oct 31) is a holiday, then
// we will not run unti the next day! (Nov 1)
log.info(job.getFullName() +
" will run at: " + firstRunTime +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
// All of the jobs have been added to the scheduler, but none of the jobs
// will run until the scheduler has been started
log.info("------- Starting Scheduler ----------------");
sched.start();
// wait 30 seconds:
// note: nothing will run
log.info("------- Waiting 30 seconds... --------------");
try {
// wait 30 seconds to show jobs
Thread.sleep(30L * 1000L);
// executing...
} catch (Exception e) {
}
// shut down the scheduler
log.info("------- Shutting Down ---------------------");
sched.shutdown(true);
log.info("------- Shutdown Complete -----------------");
SchedulerMetaData metaData = sched.getMetaData();
log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
}
public static void main(String[] args) throws Exception {
CalendarExample example = new CalendarExample();
example.run();
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example8/SimpleJob.java 0000644 0001750 0001750 00000003531 11302067147 032035 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example8;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* This is just a simple job that gets fired off many times by example 1
*
*
* @author Bill Kratzer
*/
public class SimpleJob implements Job {
private static Log _log = LogFactory.getLog(SimpleJob.class);
/**
* Empty constructor for job initilization
*/
public SimpleJob() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a
* {@link org.quartz.Trigger}
fires that is associated with
* the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
// This job simply prints out its job name and the
// date and time that it is running
String jobName = context.getJobDetail().getFullName();
_log.info("SimpleJob says: " + jobName + " executing at " + new Date());
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example12/ 0000755 0001750 0001750 00000000000 11623033644 027360 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example12/SimpleJob.java 0000644 0001750 0001750 00000004141 11302067147 032106 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example12;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* A dumb implementation of Job, for unittesting purposes.
*
*
* @author James House
*/
public class SimpleJob implements Job {
public static final String MESSAGE = "msg";
private static Log _log = LogFactory.getLog(SimpleJob.class);
/**
* Quartz requires a public empty constructor so that the
* scheduler can instantiate the class whenever it needs.
*/
public SimpleJob() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a
* {@link org.quartz.Trigger}
fires that is associated with
* the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
// This job simply prints out its job name and the
// date and time that it is running
String jobName = context.getJobDetail().getFullName();
String message = (String) context.
getJobDetail().getJobDataMap().get(MESSAGE);
_log.info("SimpleJob: " + jobName + " executing at " + new Date());
_log.info("SimpleJob: msg: " + message);
}
} ././@LongLink 0000000 0000000 0000000 00000000150 00000000000 011561 L ustar root root libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example12/RemoteClientExample.java libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example12/RemoteClientExample.j0000644 0001750 0001750 00000004500 11302067147 033437 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example12;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.CronTrigger;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.impl.StdSchedulerFactory;
/**
* This example is a client program that will remotely
* talk to the scheduler to schedule a job. In this
* example, we will need to use the JDBC Job Store. The
* client will connect to the JDBC Job Store remotely to
* schedule the job.
*
* @author James House, Bill Kratzer
*/
public class RemoteClientExample {
public void run() throws Exception {
Log log = LogFactory.getLog(RemoteClientExample.class);
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
// define the job and ask it to run
JobDetail job =
new JobDetail("remotelyAddedJob", "default", SimpleJob.class);
JobDataMap map = new JobDataMap();
map.put("msg", "Your remotely added job has executed!");
job.setJobDataMap(map);
CronTrigger trigger = new CronTrigger(
"remotelyAddedTrigger", "default",
"remotelyAddedJob", "default",
new Date(),
null,
"/5 * * ? * *");
// schedule the job
sched.scheduleJob(job, trigger);
log.info("Remote job scheduled.");
}
public static void main(String[] args) throws Exception {
RemoteClientExample example = new RemoteClientExample();
example.run();
}
} ././@LongLink 0000000 0000000 0000000 00000000150 00000000000 011561 L ustar root root libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example12/RemoteServerExample.java libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example12/RemoteServerExample.j0000644 0001750 0001750 00000005013 11302141051 033452 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example12;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SchedulerMetaData;
import org.quartz.impl.StdSchedulerFactory;
/**
* @author Bill Kratzer
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
public class RemoteServerExample {
/**
* This example will spawn a large number of jobs to run
*
* @author James House, Bill Kratzer
*/
public void run() throws Exception {
Log log = LogFactory.getLog(RemoteServerExample.class);
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
log.info("------- Initialization Complete -----------");
log.info("------- (Not Scheduling any Jobs - relying on a remote client to schedule jobs --");
log.info("------- Starting Scheduler ----------------");
// start the schedule
sched.start();
log.info("------- Started Scheduler -----------------");
log.info("------- Waiting ten minutes... ------------");
// wait five minutes to give our jobs a chance to run
try {
Thread.sleep(600L * 1000L);
} catch (Exception e) {
}
// shut down the scheduler
log.info("------- Shutting Down ---------------------");
sched.shutdown(true);
log.info("------- Shutdown Complete -----------------");
SchedulerMetaData metaData = sched.getMetaData();
log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
}
public static void main(String[] args) throws Exception {
RemoteServerExample example = new RemoteServerExample();
example.run();
}
}
libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example11/ 0000755 0001750 0001750 00000000000 11623033644 027357 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example11/SimpleJob.java 0000644 0001750 0001750 00000004363 11302067147 032113 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example11;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* This is just a simple job that gets fired off many times by example 1
*
*
* @author Bill Kratzer
*/
public class SimpleJob implements Job {
private static Log _log = LogFactory.getLog(SimpleJob.class);
// job parameter
public static final String DELAY_TIME = "delay time";
/**
* Empty constructor for job initilization
*/
public SimpleJob() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a
* {@link org.quartz.Trigger}
fires that is associated with
* the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
// This job simply prints out its job name and the
// date and time that it is running
String jobName = context.getJobDetail().getFullName();
_log.info("Executing job: " + jobName + " executing at " + new Date());
// wait for a period of time
long delayTime =
context.getJobDetail().getJobDataMap().getLong(DELAY_TIME);
try {
Thread.sleep(delayTime);
} catch (Exception e) {
}
_log.info("Finished Executing job: " + jobName + " at " + new Date());
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example11/LoadExample.java 0000644 0001750 0001750 00000007425 11302141051 032407 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example11;
import java.util.Date;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SchedulerMetaData;
import org.quartz.SimpleTrigger;
import org.quartz.impl.StdSchedulerFactory;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
/**
* This example will spawn a large number of jobs to run
*
* @author James House, Bill Kratzer
*/
public class LoadExample {
private int _numberOfJobs = 500;
public LoadExample(int inNumberOfJobs) {
_numberOfJobs = inNumberOfJobs;
}
public void run() throws Exception {
Log log = LogFactory.getLog(LoadExample.class);
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
log.info("------- Initialization Complete -----------");
String schedId = sched.getSchedulerInstanceId();
// schedule 500 jobs to run
for (int count=1; count <= _numberOfJobs; count++) {
JobDetail job = new JobDetail("job" + count, "group1",
SimpleJob.class);
// tell the job to delay some small amount... to simulate work...
long timeDelay = (long) (java.lang.Math.random() * 2500);
job.getJobDataMap().put(SimpleJob.DELAY_TIME, timeDelay);
// ask scheduler to re-execute this job if it was in progress when
// the scheduler went down...
job.setRequestsRecovery(true);
SimpleTrigger trigger = new SimpleTrigger("trigger_" + count, "group_1");
trigger.setStartTime(new Date(System.currentTimeMillis() + 10000L
+ (count * 100)));
sched.scheduleJob(job, trigger);
if (count % 25 == 0) {
log.info("...scheduled " + count + " jobs");
}
}
log.info("------- Starting Scheduler ----------------");
// start the schedule
sched.start();
log.info("------- Started Scheduler -----------------");
log.info("------- Waiting five minutes... -----------");
// wait five minutes to give our jobs a chance to run
try {
Thread.sleep(300L * 1000L);
} catch (Exception e) {
}
// shut down the scheduler
log.info("------- Shutting Down ---------------------");
sched.shutdown(true);
log.info("------- Shutdown Complete -----------------");
SchedulerMetaData metaData = sched.getMetaData();
log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
}
public static void main(String[] args) throws Exception {
int numberOfJobs = 500;
if (args.length == 1) {
numberOfJobs = Integer.parseInt(args[0]);
}
if (args.length > 1) {
System.out.println(
"Usage: java " +
LoadExample.class.getName() +
"[# of jobs]");
return;
}
LoadExample example = new LoadExample(numberOfJobs);
example.run();
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example9/ 0000755 0001750 0001750 00000000000 11623033644 027306 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example9/SimpleJob2.java 0000644 0001750 0001750 00000003535 11302067147 032124 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example9;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* This is just a simple job that gets fired off many times by example 1
*
*
* @author Bill Kratzer
*/
public class SimpleJob2 implements Job {
private static Log _log = LogFactory.getLog(SimpleJob2.class);
/**
* Empty constructor for job initilization
*/
public SimpleJob2() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a
* {@link org.quartz.Trigger}
fires that is associated with
* the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
// This job simply prints out its job name and the
// date and time that it is running
String jobName = context.getJobDetail().getFullName();
_log.info("SimpleJob2 says: " + jobName + " executing at " + new Date());
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example9/SimpleJob1.java 0000644 0001750 0001750 00000003535 11302067147 032123 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example9;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* This is just a simple job that gets fired off many times by example 1
*
*
* @author Bill Kratzer
*/
public class SimpleJob1 implements Job {
private static Log _log = LogFactory.getLog(SimpleJob1.class);
/**
* Empty constructor for job initilization
*/
public SimpleJob1() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a
* {@link org.quartz.Trigger}
fires that is associated with
* the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
// This job simply prints out its job name and the
// date and time that it is running
String jobName = context.getJobDetail().getFullName();
_log.info("SimpleJob1 says: " + jobName + " executing at " + new Date());
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example9/Job1Listener.java 0000644 0001750 0001750 00000005035 11302067147 032454 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example9;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobListener;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SimpleTrigger;
/**
* @author wkratzer
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Job1Listener implements JobListener {
private static Log _log = LogFactory.getLog(Job1Listener.class);
public String getName() {
return "job1_to_job2";
}
public void jobToBeExecuted(JobExecutionContext inContext) {
_log.info("Job1Listener says: Job Is about to be executed.");
}
public void jobExecutionVetoed(JobExecutionContext inContext) {
_log.info("Job1Listener says: Job Execution was vetoed.");
}
public void jobWasExecuted(JobExecutionContext inContext,
JobExecutionException inException) {
_log.info("Job1Listener says: Job was executed.");
// Simple job #2
JobDetail job2 =
new JobDetail("job2",
Scheduler.DEFAULT_GROUP,
SimpleJob2.class);
// Simple trigger to fire immediately
SimpleTrigger trigger =
new SimpleTrigger("job2Trigger",
Scheduler.DEFAULT_GROUP,
new Date(),
null,
0,
0L);
try {
// schedule the job to run!
inContext.getScheduler().scheduleJob(job2, trigger);
} catch (SchedulerException e) {
_log.warn("Unable to schedule job2!");
e.printStackTrace();
}
}
}
libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example9/ListenerExample.java 0000644 0001750 0001750 00000006502 11302141051 033237 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example9;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobDetail;
import org.quartz.JobListener;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SchedulerMetaData;
import org.quartz.SimpleTrigger;
import org.quartz.examples.example2.SimpleJob;
import org.quartz.impl.StdSchedulerFactory;
/**
* Demonstrates the behavior of JobListener
s. In particular,
* this example will use a job listener to trigger another job after one
* job succesfully executes.
*
*/
public class ListenerExample {
public void run() throws Exception {
Log log = LogFactory.getLog(ListenerExample.class);
log.info("------- Initializing ----------------------");
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
log.info("------- Initialization Complete -----------");
log.info("------- Scheduling Jobs -------------------");
// schedule a job to run immediately
JobDetail job = new JobDetail("job1", "group1", SimpleJob.class);
SimpleTrigger trigger = new SimpleTrigger("trigger1", "group1",
new Date(),
null,
0,
0);
// Set up the listener
JobListener listener = new Job1Listener();
sched.addJobListener(listener);
// make sure the listener is associated with the job
job.addJobListener(listener.getName());
// schedule the job to run
sched.scheduleJob(job, trigger);
// All of the jobs have been added to the scheduler, but none of the jobs
// will run until the scheduler has been started
log.info("------- Starting Scheduler ----------------");
sched.start();
// wait 30 seconds:
// note: nothing will run
log.info("------- Waiting 30 seconds... --------------");
try {
// wait 30 seconds to show jobs
Thread.sleep(30L * 1000L);
// executing...
} catch (Exception e) {
}
// shut down the scheduler
log.info("------- Shutting Down ---------------------");
sched.shutdown(true);
log.info("------- Shutdown Complete -----------------");
SchedulerMetaData metaData = sched.getMetaData();
log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
}
public static void main(String[] args) throws Exception {
ListenerExample example = new ListenerExample();
example.run();
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example5/ 0000755 0001750 0001750 00000000000 11623033643 027301 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example5/MisfireJob.java 0000644 0001750 0001750 00000004606 11302067147 032203 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example5;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.StatefulJob;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* A dumb implementation of Job, for unittesting purposes.
*
*
* @author James House
*/
public class MisfireJob implements StatefulJob {
// Logging
private static Log _log = LogFactory.getLog(MisfireJob.class);
// Constants
public static final String NUM_EXECUTIONS = "NumExecutions";
public static final String EXECUTION_DELAY = "ExecutionDelay";
/**
* Empty public constructor for job initilization
*/
public MisfireJob() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a {@link org.quartz.Trigger}
* fires that is associated with the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
String jobName = context.getJobDetail().getFullName();
_log.info("---" + jobName + " executing at " + new Date());
// default delay to five seconds
long delay = 5000L;
// use the delay passed in as a job parameter (if it exists)
JobDataMap map = context.getJobDetail().getJobDataMap();
if (map.containsKey(EXECUTION_DELAY)) {
delay = map.getLong(EXECUTION_DELAY);
}
try {
Thread.sleep(delay);
} catch (Exception ignore) {
}
_log.info("---" + jobName + " completed at " + new Date());
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example5/StatefulDumbJob.java 0000644 0001750 0001750 00000005663 11302067147 033210 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example5;
import java.util.Date;
import org.quartz.StatefulJob;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* A dumb implementation of Job, for unittesting purposes.
*
*
* @author James House
*/
public class StatefulDumbJob implements StatefulJob {
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Constants.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
public static final String NUM_EXECUTIONS = "NumExecutions";
public static final String EXECUTION_DELAY = "ExecutionDelay";
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Constructors.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
public StatefulDumbJob() {
}
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Interface.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/**
*
* Called by the {@link org.quartz.Scheduler}
when a {@link org.quartz.Trigger}
* fires that is associated with the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
System.err.println("---" + context.getJobDetail().getFullName()
+ " executing.[" + new Date() + "]");
JobDataMap map = context.getJobDetail().getJobDataMap();
int executeCount = 0;
if (map.containsKey(NUM_EXECUTIONS)) {
executeCount = map.getInt(NUM_EXECUTIONS);
}
executeCount++;
map.put(NUM_EXECUTIONS, executeCount);
long delay = 5000l;
if (map.containsKey(EXECUTION_DELAY)) {
delay = map.getLong(EXECUTION_DELAY);
}
try {
Thread.sleep(delay);
} catch (Exception ignore) {
}
System.err.println(" -" + context.getJobDetail().getFullName()
+ " complete (" + executeCount + ").");
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example5/MisfireExample.java 0000644 0001750 0001750 00000012326 11302141051 033045 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example5;
import java.util.Date;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SchedulerMetaData;
import org.quartz.SimpleTrigger;
import org.quartz.TriggerUtils;
import org.quartz.impl.StdSchedulerFactory;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
/**
* Demonstrates the behavior of StatefulJob
s, as well as how
* misfire instructions affect the firings of triggers of StatefulJob
* s - when the jobs take longer to execute that the frequency of the trigger's
* repitition.
*
*
* While the example is running, you should note that there are two triggers
* with identical schedules, firing identical jobs. The triggers "want" to fire
* every 3 seconds, but the jobs take 10 seconds to execute. Therefore, by the
* time the jobs complete their execution, the triggers have already "misfired"
* (unless the scheduler's "misfire threshold" has been set to more than 7
* seconds). You should see that one of the jobs has its misfire instruction
* set to SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT
,
* which causes it to fire immediately, when the misfire is detected. The other
* trigger uses the default "smart policy" misfire instruction, which causes
* the trigger to advance to its next fire time (skipping those that it has
* missed) - so that it does not refire immediately, but rather at the next
* scheduled time.
*
*
* @author Chris Bonham
*/
public class MisfireExample {
public void run() throws Exception {
Log log = LogFactory.getLog(MisfireExample.class);
log.info("------- Initializing -------------------");
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
log.info("------- Initialization Complete -----------");
log.info("------- Scheduling Jobs -----------");
// jobs can be scheduled before start() has been called
// get a "nice round" time a few seconds in the future...
long ts = TriggerUtils.getNextGivenSecondDate(null, 15).getTime();
// statefulJob1 will run every three seconds
// (but it will delay for ten seconds)
JobDetail job = new JobDetail("statefulJob1", "group1",
StatefulDumbJob.class);
job.getJobDataMap().put(MisfireJob.EXECUTION_DELAY, 10000L);
SimpleTrigger trigger = new SimpleTrigger("trigger1", "group1",
new Date(ts), null,
SimpleTrigger.REPEAT_INDEFINITELY, 3000L);
Date ft = sched.scheduleJob(job, trigger);
log.info(job.getFullName() +
" will run at: " + ft +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
// statefulJob2 will run every three seconds
// (but it will delay for ten seconds)
job = new JobDetail("statefulJob2", "group1", StatefulDumbJob.class);
job.getJobDataMap().put(MisfireJob.EXECUTION_DELAY, 10000L);
trigger = new SimpleTrigger("trigger2", "group1",
new Date(ts), null,
SimpleTrigger.REPEAT_INDEFINITELY, 3000L);
trigger
.setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT);
ft = sched.scheduleJob(job, trigger);
log.info(job.getFullName() +
" will run at: " + ft +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
log.info("------- Starting Scheduler ----------------");
// jobs don't start firing until start() has been called...
sched.start();
log.info("------- Started Scheduler -----------------");
try {
// sleep for ten minutes for triggers to file....
Thread.sleep(600L * 1000L);
} catch (Exception e) {
}
log.info("------- Shutting Down ---------------------");
sched.shutdown(true);
log.info("------- Shutdown Complete -----------------");
SchedulerMetaData metaData = sched.getMetaData();
log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
}
public static void main(String[] args) throws Exception {
MisfireExample example = new MisfireExample();
example.run();
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example6/ 0000755 0001750 0001750 00000000000 11623033643 027302 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example6/BadJob2.java 0000644 0001750 0001750 00000004625 11302067147 031357 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example6;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.StatefulJob;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* A job dumb job that will throw a job execution exception
*
*
* @author Bill Kratzer
*/
public class BadJob2 implements StatefulJob {
// Logging
private static Log _log = LogFactory.getLog(BadJob2.class);
/**
* Empty public constructor for job initilization
*/
public BadJob2() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a {@link org.quartz.Trigger}
* fires that is associated with the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
String jobName = context.getJobDetail().getFullName();
_log.info("---" + jobName + " executing at " + new Date());
// a contrived example of an exception that
// will be generated by this job due to a
// divide by zero error
try {
int zero = 0;
int calculation = 4815 / zero;
} catch (Exception e) {
_log.info("--- Error in job!");
JobExecutionException e2 =
new JobExecutionException(e);
// Quartz will automatically unschedule
// all triggers associated with this job
// so that it does not run again
e2.setUnscheduleAllTriggers(true);
throw e2;
}
_log.info("---" + jobName + " completed at " + new Date());
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example6/BadJob1.java 0000644 0001750 0001750 00000004454 11302067147 031356 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example6;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.StatefulJob;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* A job dumb job that will throw a job execution exception
*
*
* @author Bill Kratzer
*/
public class BadJob1 implements StatefulJob {
// Logging
private static Log _log = LogFactory.getLog(BadJob1.class);
/**
* Empty public constructor for job initilization
*/
public BadJob1() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a {@link org.quartz.Trigger}
* fires that is associated with the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
String jobName = context.getJobDetail().getFullName();
_log.info("---" + jobName + " executing at " + new Date());
// a contrived example of an exception that
// will be generated by this job due to a
// divide by zero error
try {
int zero = 0;
int calculation = 4815 / zero;
} catch (Exception e) {
_log.info("--- Error in job!");
JobExecutionException e2 =
new JobExecutionException(e);
// this job will refire immediately
e2.setRefireImmediately(true);
throw e2;
}
_log.info("---" + jobName + " completed at " + new Date());
}
}
././@LongLink 0000000 0000000 0000000 00000000147 00000000000 011567 L ustar root root libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example6/JobExceptionExample.java libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example6/JobExceptionExample.ja0000644 0001750 0001750 00000007435 11302141051 033517 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example6;
import java.util.Date;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SchedulerMetaData;
import org.quartz.SimpleTrigger;
import org.quartz.TriggerUtils;
import org.quartz.impl.StdSchedulerFactory;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
/**
*
* This job demonstrates how Quartz can handle JobExecutionExceptions that are
* thrown by jobs.
*
* @author Bill Kratzer
*/
public class JobExceptionExample {
public void run() throws Exception {
Log log = LogFactory.getLog(JobExceptionExample.class);
log.info("------- Initializing ----------------------");
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
log.info("------- Initialization Complete ------------");
log.info("------- Scheduling Jobs -------------------");
// jobs can be scheduled before start() has been called
// get a "nice round" time a few seconds in the future...
long ts = TriggerUtils.getNextGivenSecondDate(null, 15).getTime();
// badJob1 will run every three seconds
// this job will throw an exception and refire
// immediately
JobDetail job = new JobDetail("badJob1", "group1", BadJob1.class);
SimpleTrigger trigger = new SimpleTrigger("trigger1", "group1",
new Date(ts), null, SimpleTrigger.REPEAT_INDEFINITELY, 3000L);
Date ft = sched.scheduleJob(job, trigger);
log.info(job.getFullName() + " will run at: " + ft + " and repeat: "
+ trigger.getRepeatCount() + " times, every "
+ trigger.getRepeatInterval() / 1000 + " seconds");
// badJob2 will run every three seconds
// this job will throw an exception and never
// refire
job = new JobDetail("badJob2", "group1", BadJob2.class);
trigger = new SimpleTrigger("trigger2", "group1", new Date(ts), null,
SimpleTrigger.REPEAT_INDEFINITELY, 3000L);
ft = sched.scheduleJob(job, trigger);
log.info(job.getFullName() + " will run at: " + ft + " and repeat: "
+ trigger.getRepeatCount() + " times, every "
+ trigger.getRepeatInterval() / 1000 + " seconds");
log.info("------- Starting Scheduler ----------------");
// jobs don't start firing until start() has been called...
sched.start();
log.info("------- Started Scheduler -----------------");
try {
// sleep for 60 seconds
Thread.sleep(60L * 1000L);
} catch (Exception e) {
}
log.info("------- Shutting Down ---------------------");
sched.shutdown(true);
log.info("------- Shutdown Complete -----------------");
SchedulerMetaData metaData = sched.getMetaData();
log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
}
public static void main(String[] args) throws Exception {
JobExceptionExample example = new JobExceptionExample();
example.run();
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example3/ 0000755 0001750 0001750 00000000000 11623033644 027300 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example3/SimpleJob.java 0000644 0001750 0001750 00000003646 11302067147 032037 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example3;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* This is just a simple job that gets fired off many times by example 1
*
*
* @author Bill Kratzer
*/
public class SimpleJob implements Job {
private static Log _log = LogFactory.getLog(SimpleJob.class);
/**
* Quartz requires a public empty constructor so that the
* scheduler can instantiate the class whenever it needs.
*/
public SimpleJob() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a
* {@link org.quartz.Trigger}
fires that is associated with
* the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
// This job simply prints out its job name and the
// date and time that it is running
String jobName = context.getJobDetail().getFullName();
_log.info("SimpleJob says: " + jobName + " executing at " + new Date());
}
} ././@LongLink 0000000 0000000 0000000 00000000146 00000000000 011566 L ustar root root libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example3/CronTriggerExample.java libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example3/CronTriggerExample.jav0000644 0001750 0001750 00000014167 11302141051 033536 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example3;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SchedulerMetaData;
import org.quartz.impl.StdSchedulerFactory;
/**
* This Example will demonstrate all of the basics of scheduling capabilities of
* Quartz using Cron Triggers.
*
* @author Bill Kratzer
*/
public class CronTriggerExample {
public void run() throws Exception {
Log log = LogFactory.getLog(CronTriggerExample.class);
log.info("------- Initializing -------------------");
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
log.info("------- Initialization Complete --------");
log.info("------- Scheduling Jobs ----------------");
// jobs can be scheduled before sched.start() has been called
// job 1 will run every 20 seconds
JobDetail job = new JobDetail("job1", "group1", SimpleJob.class);
CronTrigger trigger = new CronTrigger("trigger1", "group1", "job1",
"group1", "0/20 * * * * ?");
sched.addJob(job, true);
Date ft = sched.scheduleJob(trigger);
log.info(job.getFullName() + " has been scheduled to run at: " + ft
+ " and repeat based on expression: "
+ trigger.getCronExpression());
// job 2 will run every other minute (at 15 seconds past the minute)
job = new JobDetail("job2", "group1", SimpleJob.class);
trigger = new CronTrigger("trigger2", "group1", "job2", "group1",
"15 0/2 * * * ?");
sched.addJob(job, true);
ft = sched.scheduleJob(trigger);
log.info(job.getFullName() + " has been scheduled to run at: " + ft
+ " and repeat based on expression: "
+ trigger.getCronExpression());
// job 3 will run every other minute but only between 8am and 5pm
job = new JobDetail("job3", "group1", SimpleJob.class);
trigger = new CronTrigger("trigger3", "group1", "job3", "group1",
"0 0/2 8-17 * * ?");
sched.addJob(job, true);
ft = sched.scheduleJob(trigger);
log.info(job.getFullName() + " has been scheduled to run at: " + ft
+ " and repeat based on expression: "
+ trigger.getCronExpression());
// job 4 will run every three minutes but only between 5pm and 11pm
job = new JobDetail("job4", "group1", SimpleJob.class);
trigger = new CronTrigger("trigger4", "group1", "job4", "group1",
"0 0/3 17-23 * * ?");
sched.addJob(job, true);
ft = sched.scheduleJob(trigger);
log.info(job.getFullName() + " has been scheduled to run at: " + ft
+ " and repeat based on expression: "
+ trigger.getCronExpression());
// job 5 will run at 10am on the 1st and 15th days of the month
job = new JobDetail("job5", "group1", SimpleJob.class);
trigger = new CronTrigger("trigger5", "group1", "job5", "group1",
"0 0 10am 1,15 * ?");
sched.addJob(job, true);
ft = sched.scheduleJob(trigger);
log.info(job.getFullName() + " has been scheduled to run at: " + ft
+ " and repeat based on expression: "
+ trigger.getCronExpression());
// job 6 will run every 30 seconds but only on Weekdays (Monday through
// Friday)
job = new JobDetail("job6", "group1", SimpleJob.class);
trigger = new CronTrigger("trigger6", "group1", "job6", "group1",
"0,30 * * ? * MON-FRI");
sched.addJob(job, true);
ft = sched.scheduleJob(trigger);
log.info(job.getFullName() + " has been scheduled to run at: " + ft
+ " and repeat based on expression: "
+ trigger.getCronExpression());
// job 7 will run every 30 seconds but only on Weekends (Saturday and
// Sunday)
job = new JobDetail("job7", "group1", SimpleJob.class);
trigger = new CronTrigger("trigger7", "group1", "job7", "group1",
"0,30 * * ? * SAT,SUN");
sched.addJob(job, true);
ft = sched.scheduleJob(trigger);
log.info(job.getFullName() + " has been scheduled to run at: " + ft
+ " and repeat based on expression: "
+ trigger.getCronExpression());
log.info("------- Starting Scheduler ----------------");
// All of the jobs have been added to the scheduler, but none of the
// jobs
// will run until the scheduler has been started
sched.start();
log.info("------- Started Scheduler -----------------");
log.info("------- Waiting five minutes... ------------");
try {
// wait five minutes to show jobs
Thread.sleep(300L * 1000L);
// executing...
} catch (Exception e) {
}
log.info("------- Shutting Down ---------------------");
sched.shutdown(true);
log.info("------- Shutdown Complete -----------------");
SchedulerMetaData metaData = sched.getMetaData();
log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
}
public static void main(String[] args) throws Exception {
CronTriggerExample example = new CronTriggerExample();
example.run();
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example7/ 0000755 0001750 0001750 00000000000 11623033643 027303 5 ustar twerner twerner ././@LongLink 0000000 0000000 0000000 00000000150 00000000000 011561 L ustar root root libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example7/DumbInterruptableJob.java libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example7/DumbInterruptableJob.j0000644 0001750 0001750 00000007023 11302067147 033543 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example7;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.InterruptableJob;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.UnableToInterruptJobException;
/**
*
* A dumb implementation of an InterruptableJob, for unittesting purposes.
*
*
* @author Chris Bonham
* @author Bill Kratzer
*/
public class DumbInterruptableJob implements InterruptableJob {
// logging services
private static Log _log = LogFactory.getLog(DumbInterruptableJob.class);
// has the job been interrupted?
private boolean _interrupted = false;
// job name
private String _jobName = "";
/**
*
* Empty constructor for job initilization
*
*/
public DumbInterruptableJob() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a {@link org.quartz.Trigger}
* fires that is associated with the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
_jobName = context.getJobDetail().getFullName();
_log.info("---- " + _jobName + " executing at " + new Date());
try {
// main job loop... see the JavaDOC for InterruptableJob for discussion...
// do some work... in this example we are 'simulating' work by sleeping... :)
for (int i = 0; i < 4; i++) {
try {
Thread.sleep(1000L);
} catch (Exception ignore) {
ignore.printStackTrace();
}
// periodically check if we've been interrupted...
if(_interrupted) {
_log.info("--- " + _jobName + " -- Interrupted... bailing out!");
return; // could also choose to throw a JobExecutionException
// if that made for sense based on the particular
// job's responsibilities/behaviors
}
}
} finally {
_log.info("---- " + _jobName + " completed at " + new Date());
}
}
/**
*
* Called by the {@link Scheduler}
when a user
* interrupts the Job
.
*
*
* @return void (nothing) if job interrupt is successful.
* @throws JobExecutionException
* if there is an exception while interrupting the job.
*/
public void interrupt() throws UnableToInterruptJobException {
_log.info("---" + " -- INTERRUPTING --");
_interrupted = true;
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example7/InterruptExample.java 0000644 0001750 0001750 00000010714 11302141051 033444 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example7;
import java.util.Date;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SchedulerMetaData;
import org.quartz.SimpleTrigger;
import org.quartz.TriggerUtils;
import org.quartz.impl.StdSchedulerFactory;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
/**
* Demonstrates the behavior of StatefulJob
s, as well as how
* misfire instructions affect the firings of triggers of StatefulJob
* s - when the jobs take longer to execute that the frequency of the trigger's
* repitition.
*
*
* While the example is running, you should note that there are two triggers
* with identical schedules, firing identical jobs. The triggers "want" to fire
* every 3 seconds, but the jobs take 10 seconds to execute. Therefore, by the
* time the jobs complete their execution, the triggers have already "misfired"
* (unless the scheduler's "misfire threshold" has been set to more than 7
* seconds). You should see that one of the jobs has its misfire instruction
* set to SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT
-
* which causes it to fire immediately, when the misfire is detected. The other
* trigger uses the default "smart policy" misfire instruction, which causes
* the trigger to advance to its next fire time (skipping those that it has
* missed) - so that it does not refire immediately, but rather at the next
* scheduled time.
*
*
* @author Chris Bonham
*/
public class InterruptExample {
public void run() throws Exception {
final Log log = LogFactory.getLog(InterruptExample.class);
log.info("------- Initializing ----------------------");
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
log.info("------- Initialization Complete -----------");
log.info("------- Scheduling Jobs -------------------");
// get a "nice round" time a few seconds in the future...
long ts = TriggerUtils.getNextGivenSecondDate(null, 15).getTime();
JobDetail job = new JobDetail("interruptableJob1", "group1",
DumbInterruptableJob.class);
SimpleTrigger trigger =
new SimpleTrigger("trigger1", "group1",
new Date(ts),
null,
SimpleTrigger.REPEAT_INDEFINITELY,
5000L);
Date ft = sched.scheduleJob(job, trigger);
log.info(job.getFullName() + " will run at: " + ft + " and repeat: "
+ trigger.getRepeatCount() + " times, every "
+ trigger.getRepeatInterval() / 1000 + " seconds");
// start up the scheduler (jobs do not start to fire until
// the scheduler has been started)
sched.start();
log.info("------- Started Scheduler -----------------");
log.info("------- Starting loop to interrupt job every 7 seconds ----------");
for(int i=0; i < 50; i++) {
try {
Thread.sleep(7000L);
// tell the scheduler to interrupt our job
sched.interrupt(job.getName(), job.getGroup());
} catch (Exception e) {
}
}
log.info("------- Shutting Down ---------------------");
sched.shutdown(true);
log.info("------- Shutdown Complete -----------------");
SchedulerMetaData metaData = sched.getMetaData();
log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
}
public static void main(String[] args) throws Exception {
InterruptExample example = new InterruptExample();
example.run();
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example13/ 0000755 0001750 0001750 00000000000 11623033643 027360 5 ustar twerner twerner ././@LongLink 0000000 0000000 0000000 00000000156 00000000000 011567 L ustar root root libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example13/SimpleRecoveryStatefulJob.java libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example13/SimpleRecoveryStatefu0000644 0001750 0001750 00000001773 11302067147 033617 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example13;
import org.quartz.StatefulJob;
/**
* This job has the same functionality of SimpleRecoveryJob
* except that this job implements the StatefulJob interface
*
* @author Bill Kratzer
*/
public class SimpleRecoveryStatefulJob
extends SimpleRecoveryJob
implements StatefulJob {
public SimpleRecoveryStatefulJob() {
super();
}
}
libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example13/ClusterExample.java 0000644 0001750 0001750 00000020521 11302067147 033160 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example13;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SimpleTrigger;
import org.quartz.impl.StdSchedulerFactory;
/**
* Used to test/show the clustering features of JDBCJobStore (JobStoreTX or
* JobStoreCMT).
*
*
* All instances MUST use a different properties file, because their instance
* Ids must be different, however all other properties should be the same.
*
*
*
* If you want it to clear out existing jobs & triggers, pass a command-line
* argument called "clearJobs".
*
*
*
* You should probably start with a "fresh" set of tables (assuming you may
* have some data lingering in it from other tests), since mixing data from a
* non-clustered setup with a clustered one can be bad.
*
*
*
* Try killing one of the cluster instances while they are running, and see
* that the remaining instance(s) recover the in-progress jobs. Note that
* detection of the failure may take up to 15 or so seconds with the default
* settings.
*
*
*
* Also try running it with/without the shutdown-hook plugin registered with
* the scheduler. (org.quartz.plugins.management.ShutdownHookPlugin).
*
*
*
* Note: Never run clustering on separate machines, unless their
* clocks are synchronized using some form of time-sync service (daemon).
*
*
* @see DumbRecoveryJob
*
* @author James House
*/
public class ClusterExample {
private static Log _log = LogFactory.getLog(ClusterExample.class);
public void cleanUp(Scheduler inScheduler) throws Exception {
_log.warn("***** Deleting existing jobs/triggers *****");
// unschedule jobs
String[] groups = inScheduler.getTriggerGroupNames();
for (int i = 0; i < groups.length; i++) {
String[] names = inScheduler.getTriggerNames(groups[i]);
for (int j = 0; j < names.length; j++) {
inScheduler.unscheduleJob(names[j], groups[i]);
}
}
// delete jobs
groups = inScheduler.getJobGroupNames();
for (int i = 0; i < groups.length; i++) {
String[] names = inScheduler.getJobNames(groups[i]);
for (int j = 0; j < names.length; j++) {
inScheduler.deleteJob(names[j], groups[i]);
}
}
}
public void run(boolean inClearJobs, boolean inScheduleJobs)
throws Exception {
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
if (inClearJobs) {
cleanUp(sched);
}
_log.info("------- Initialization Complete -----------");
if (inScheduleJobs) {
_log.info("------- Scheduling Jobs ------------------");
String schedId = sched.getSchedulerInstanceId();
int count = 1;
JobDetail job = new JobDetail("job_" + count, schedId,
SimpleRecoveryJob.class);
// ask scheduler to re-execute this job if it was in progress when
// the scheduler went down...
job.setRequestsRecovery(true);
SimpleTrigger trigger =
new SimpleTrigger("triger_" + count, schedId, 20, 5000L);
trigger.setStartTime(new Date(System.currentTimeMillis() + 1000L));
_log.info(job.getFullName() +
" will run at: " + trigger.getNextFireTime() +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
sched.scheduleJob(job, trigger);
count++;
job = new JobDetail("job_" + count, schedId,
SimpleRecoveryJob.class);
// ask scheduler to re-execute this job if it was in progress when
// the scheduler went down...
job.setRequestsRecovery(true);
trigger = new SimpleTrigger("trig_" + count, schedId, 20, 5000L);
trigger.setStartTime(new Date(System.currentTimeMillis() + 2000L));
_log.info(job.getFullName() +
" will run at: " + trigger.getNextFireTime() +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
sched.scheduleJob(job, trigger);
count++;
job = new JobDetail("job_" + count, schedId,
SimpleRecoveryStatefulJob.class);
// ask scheduler to re-execute this job if it was in progress when
// the scheduler went down...
job.setRequestsRecovery(true);
trigger = new SimpleTrigger("trig_" + count, schedId, 20, 3000L);
trigger.setStartTime(new Date(System.currentTimeMillis() + 1000L));
_log.info(job.getFullName() +
" will run at: " + trigger.getNextFireTime() +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
sched.scheduleJob(job, trigger);
count++;
job = new JobDetail("job_" + count, schedId, SimpleRecoveryJob.class);
// ask scheduler to re-execute this job if it was in progress when
// the scheduler went down...
job.setRequestsRecovery(true);
trigger = new SimpleTrigger("trig_" + count, schedId, 20, 4000L);
trigger.setStartTime(new Date(System.currentTimeMillis() + 1000L));
_log.info(job.getFullName() + " will run at: "
+ trigger.getNextFireTime() + " & repeat: "
+ trigger.getRepeatCount() + "/"
+ trigger.getRepeatInterval());
sched.scheduleJob(job, trigger);
count++;
job = new JobDetail("job_" + count, schedId, SimpleRecoveryJob.class);
// ask scheduler to re-execute this job if it was in progress when
// the scheduler went down...
job.setRequestsRecovery(true);
trigger = new SimpleTrigger("trig_" + count, schedId, 20, 4500L);
trigger.setStartTime(new Date(System.currentTimeMillis() + 1000L));
_log.info(job.getFullName() + " will run at: "
+ trigger.getNextFireTime() + " & repeat: "
+ trigger.getRepeatCount() + "/"
+ trigger.getRepeatInterval());
sched.scheduleJob(job, trigger);
}
// jobs don't start firing until start() has been called...
_log.info("------- Starting Scheduler ---------------");
sched.start();
_log.info("------- Started Scheduler ----------------");
_log.info("------- Waiting for one hour... ----------");
try {
Thread.sleep(3600L * 1000L);
} catch (Exception e) {
}
_log.info("------- Shutting Down --------------------");
sched.shutdown();
_log.info("------- Shutdown Complete ----------------");
}
public static void main(String[] args) throws Exception {
boolean clearJobs = false;
boolean scheduleJobs = true;
for (int i = 0; i < args.length; i++) {
if (args[i].equalsIgnoreCase("clearJobs")) {
clearJobs = true;
} else if (args[i].equalsIgnoreCase("dontScheduleJobs")) {
scheduleJobs = false;
}
}
ClusterExample example = new ClusterExample();
example.run(clearJobs, scheduleJobs);
}
}
././@LongLink 0000000 0000000 0000000 00000000146 00000000000 011566 L ustar root root libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example13/SimpleRecoveryJob.java libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example13/SimpleRecoveryJob.jav0000644 0001750 0001750 00000005274 11302067147 033475 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example13;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* A dumb implementation of Job, for unittesting purposes.
*
*
* @author James House
*/
public class SimpleRecoveryJob implements Job {
private static Log _log = LogFactory.getLog(SimpleRecoveryJob.class);
private static final String COUNT = "count";
/**
* Quartz requires a public empty constructor so that the
* scheduler can instantiate the class whenever it needs.
*/
public SimpleRecoveryJob() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a
* {@link org.quartz.Trigger}
fires that is associated with
* the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
String jobName = context.getJobDetail().getFullName();
// if the job is recovering print a message
if (context.isRecovering()) {
_log.info("SimpleRecoveryJob: " + jobName + " RECOVERING at " + new Date());
} else {
_log.info("SimpleRecoveryJob: " + jobName + " starting at " + new Date());
}
// delay for ten seconds
long delay = 10L * 1000L;
try {
Thread.sleep(delay);
} catch (Exception e) {
}
JobDataMap data = context.getJobDetail().getJobDataMap();
int count;
if (data.containsKey(COUNT)) {
count = data.getInt(COUNT);
} else {
count = 0;
}
count++;
data.put(COUNT, count);
_log.info("SimpleRecoveryJob: " + jobName +
" done at " + new Date() +
"\n Execution #" + count);
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example10/ 0000755 0001750 0001750 00000000000 11623033644 027356 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example10/PlugInExample.java 0000644 0001750 0001750 00000004451 11302141051 032721 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example10;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SchedulerMetaData;
import org.quartz.impl.StdSchedulerFactory;
/**
* This example will spawn a large number of jobs to run
*
* @author James House, Bill Kratzer
*/
public class PlugInExample {
public void run() throws Exception {
Log log = LogFactory.getLog(PlugInExample.class);
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
log.info("------- Initialization Complete -----------");
log.info("------- (Not Scheduling any Jobs - relying on XML definitions --");
log.info("------- Starting Scheduler ----------------");
// start the schedule
sched.start();
log.info("------- Started Scheduler -----------------");
log.info("------- Waiting five minutes... -----------");
// wait five minutes to give our jobs a chance to run
try {
Thread.sleep(300L * 1000L);
} catch (Exception e) {
}
// shut down the scheduler
log.info("------- Shutting Down ---------------------");
sched.shutdown(true);
log.info("------- Shutdown Complete -----------------");
SchedulerMetaData metaData = sched.getMetaData();
log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
}
public static void main(String[] args) throws Exception {
PlugInExample example = new PlugInExample();
example.run();
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example10/SimpleJob.java 0000644 0001750 0001750 00000003542 11302067147 032110 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example10;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* This is just a simple job that gets fired off many times by example 1
*
*
* @author Bill Kratzer
*/
public class SimpleJob implements Job {
private static Log _log = LogFactory.getLog(SimpleJob.class);
/**
* Empty constructor for job initilization
*/
public SimpleJob() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a
* {@link org.quartz.Trigger}
fires that is associated with
* the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
// This job simply prints out its job name and the
// date and time that it is running
String jobName = context.getJobDetail().getFullName();
_log.info("Executing job: " + jobName + " executing at " + new Date());
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example4/ 0000755 0001750 0001750 00000000000 11623033643 027300 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example4/ColorJob.java 0000644 0001750 0001750 00000006326 11302067147 031663 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example4;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.StatefulJob;
/**
*
* This is just a simple job that receives parameters and
* maintains state
*
*
* @author Bill Kratzer
*/
public class ColorJob implements StatefulJob {
private static Log _log = LogFactory.getLog(ColorJob.class);
// parameter names specific to this job
public static final String FAVORITE_COLOR = "favorite color";
public static final String EXECUTION_COUNT = "count";
// Since Quartz will re-instantiate a class every time it
// gets executed, members non-static member variables can
// not be used to maintain state!
private int _counter = 1;
/**
*
* Empty constructor for job initilization
*
*
* Quartz requires a public empty constructor so that the
* scheduler can instantiate the class whenever it needs.
*
*/
public ColorJob() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a
* {@link org.quartz.Trigger}
fires that is associated with
* the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
// This job simply prints out its job name and the
// date and time that it is running
String jobName = context.getJobDetail().getFullName();
// Grab and print passed parameters
JobDataMap data = context.getJobDetail().getJobDataMap();
String favoriteColor = data.getString(FAVORITE_COLOR);
int count = data.getInt(EXECUTION_COUNT);
_log.info("ColorJob: " + jobName + " executing at " + new Date() + "\n" +
" favorite color is " + favoriteColor + "\n" +
" execution count (from job map) is " + count + "\n" +
" execution count (from job member variable) is " + _counter);
// increment the count and store it back into the
// job map so that job state can be properly maintained
count++;
data.put(EXECUTION_COUNT, count);
// Increment the local member variable
// This serves no real purpose since job state can not
// be maintained via member variables!
_counter++;
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example4/JobStateExample.java 0000644 0001750 0001750 00000010537 11302141051 033163 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example4;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SchedulerMetaData;
import org.quartz.SimpleTrigger;
import org.quartz.TriggerUtils;
import org.quartz.impl.StdSchedulerFactory;
/**
* This Example will demonstrate how job parameters can be
* passed into jobs and how state can be maintained
*
* @author Bill Kratzer
*/
public class JobStateExample {
public void run() throws Exception {
Log log = LogFactory.getLog(JobStateExample.class);
log.info("------- Initializing -------------------");
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
log.info("------- Initialization Complete --------");
log.info("------- Scheduling Jobs ----------------");
// get a "nice round" time a few seconds in the future....
long ts = TriggerUtils.getNextGivenSecondDate(null, 10).getTime();
// job1 will only run 5 times, every 10 seconds
JobDetail job1 = new JobDetail("job1", "group1", ColorJob.class);
SimpleTrigger trigger1 = new SimpleTrigger("trigger1", "group1", "job1", "group1",
new Date(ts), null, 4, 10000);
// pass initialization parameters into the job
job1.getJobDataMap().put(ColorJob.FAVORITE_COLOR, "Green");
job1.getJobDataMap().put(ColorJob.EXECUTION_COUNT, 1);
// schedule the job to run
Date scheduleTime1 = sched.scheduleJob(job1, trigger1);
log.info(job1.getFullName() +
" will run at: " + scheduleTime1 +
" and repeat: " + trigger1.getRepeatCount() +
" times, every " + trigger1.getRepeatInterval() / 1000 + " seconds");
// job2 will also run 5 times, every 10 seconds
JobDetail job2 = new JobDetail("job2", "group1", ColorJob.class);
SimpleTrigger trigger2 = new SimpleTrigger("trigger2", "group1", "job2", "group1",
new Date(ts + 1000), null, 4, 10000);
// pass initialization parameters into the job
// this job has a different favorite color!
job2.getJobDataMap().put(ColorJob.FAVORITE_COLOR, "Red");
job2.getJobDataMap().put(ColorJob.EXECUTION_COUNT, 1);
// schedule the job to run
Date scheduleTime2 = sched.scheduleJob(job2, trigger2);
log.info(job2.getFullName() +
" will run at: " + scheduleTime2 +
" and repeat: " + trigger2.getRepeatCount() +
" times, every " + trigger2.getRepeatInterval() / 1000 + " seconds");
log.info("------- Starting Scheduler ----------------");
// All of the jobs have been added to the scheduler, but none of the jobs
// will run until the scheduler has been started
sched.start();
log.info("------- Started Scheduler -----------------");
log.info("------- Waiting 60 seconds... -------------");
try {
// wait five minutes to show jobs
Thread.sleep(60L * 1000L);
// executing...
} catch (Exception e) {
}
log.info("------- Shutting Down ---------------------");
sched.shutdown(true);
log.info("------- Shutdown Complete -----------------");
SchedulerMetaData metaData = sched.getMetaData();
log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
}
public static void main(String[] args) throws Exception {
JobStateExample example = new JobStateExample();
example.run();
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example1/ 0000755 0001750 0001750 00000000000 11623033644 027276 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example1/SimpleExample.java 0000644 0001750 0001750 00000006053 11302067147 032711 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example1;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SimpleTrigger;
import org.quartz.TriggerUtils;
import org.quartz.impl.StdSchedulerFactory;
/**
* This Example will demonstrate how to start and shutdown the Quartz
* scheduler and how to schedule a job to run in Quartz.
*
* @author Bill Kratzer
*/
public class SimpleExample {
public void run() throws Exception {
Log log = LogFactory.getLog(SimpleExample.class);
log.info("------- Initializing ----------------------");
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
log.info("------- Initialization Complete -----------");
log.info("------- Scheduling Jobs -------------------");
// computer a time that is on the next round minute
Date runTime = TriggerUtils.getEvenMinuteDate(new Date());
// define the job and tie it to our HelloJob class
JobDetail job = new JobDetail("job1", "group1", HelloJob.class);
// Trigger the job to run on the next round minute
SimpleTrigger trigger =
new SimpleTrigger("trigger1", "group1", runTime);
// Tell quartz to schedule the job using our trigger
sched.scheduleJob(job, trigger);
log.info(job.getFullName() + " will run at: " + runTime);
// Start up the scheduler (nothing can actually run until the
// scheduler has been started)
sched.start();
log.info("------- Started Scheduler -----------------");
// wait long enough so that the scheduler as an opportunity to
// run the job!
log.info("------- Waiting 90 seconds... -------------");
try {
// wait 90 seconds to show jobs
Thread.sleep(90L * 1000L);
// executing...
} catch (Exception e) {
}
// shut down the scheduler
log.info("------- Shutting Down ---------------------");
sched.shutdown(true);
log.info("------- Shutdown Complete -----------------");
}
public static void main(String[] args) throws Exception {
SimpleExample example = new SimpleExample();
example.run();
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example1/HelloJob.java 0000644 0001750 0001750 00000003554 11302067147 031645 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example1;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* This is just a simple job that says "Hello" to the world.
*
*
* @author Bill Kratzer
*/
public class HelloJob implements Job {
private static Log _log = LogFactory.getLog(HelloJob.class);
/**
*
* Empty constructor for job initilization
*
*
* Quartz requires a public empty constructor so that the
* scheduler can instantiate the class whenever it needs.
*
*/
public HelloJob() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a
* {@link org.quartz.Trigger}
fires that is associated with
* the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
// Say Hello to the World and display the date/time
_log.info("Hello World! - " + new Date());
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example2/ 0000755 0001750 0001750 00000000000 11623033644 027277 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example2/SimpleJob.java 0000644 0001750 0001750 00000003531 11302067147 032027 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example2;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
*
* This is just a simple job that gets fired off many times by example 1
*
*
* @author Bill Kratzer
*/
public class SimpleJob implements Job {
private static Log _log = LogFactory.getLog(SimpleJob.class);
/**
* Empty constructor for job initilization
*/
public SimpleJob() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a
* {@link org.quartz.Trigger}
fires that is associated with
* the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
// This job simply prints out its job name and the
// date and time that it is running
String jobName = context.getJobDetail().getFullName();
_log.info("SimpleJob says: " + jobName + " executing at " + new Date());
}
} ././@LongLink 0000000 0000000 0000000 00000000150 00000000000 011561 L ustar root root libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example2/SimpleTriggerExample.java libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example2/SimpleTriggerExample.j0000644 0001750 0001750 00000020266 11302141051 033533 0 ustar twerner twerner /*
* Copyright 2005 - 2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example2;
import java.util.Date;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SchedulerMetaData;
import org.quartz.SimpleTrigger;
import org.quartz.TriggerUtils;
import org.quartz.impl.StdSchedulerFactory;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
/**
* This Example will demonstrate all of the basics of scheduling capabilities
* of Quartz using Simple Triggers.
*
* @author Bill Kratzer
*/
public class SimpleTriggerExample {
public void run() throws Exception {
Log log = LogFactory.getLog(SimpleTriggerExample.class);
log.info("------- Initializing -------------------");
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
log.info("------- Initialization Complete --------");
log.info("------- Scheduling Jobs ----------------");
// jobs can be scheduled before sched.start() has been called
// get a "nice round" time a few seconds in the future...
long ts = TriggerUtils.getNextGivenSecondDate(null, 15).getTime();
// job1 will only fire once at date/time "ts"
JobDetail job = new JobDetail("job1", "group1", SimpleJob.class);
SimpleTrigger trigger =
new SimpleTrigger("trigger1", "group1", new Date(ts));
// schedule it to run!
Date ft = sched.scheduleJob(job, trigger);
log.info(job.getFullName() +
" will run at: " + ft +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
// job2 will only fire once at date/time "ts"
job = new JobDetail("job2", "group1", SimpleJob.class);
trigger = new SimpleTrigger("trigger2", "group1", "job2", "group1",
new Date(ts), null, 0, 0);
ft = sched.scheduleJob(job, trigger);
log.info(job.getFullName() +
" will run at: " + ft +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
// job3 will run 11 times (run once and repeat 10 more times)
// job3 will repeat every 10 seconds (10000 ms)
job = new JobDetail("job3", "group1", SimpleJob.class);
trigger = new SimpleTrigger("trigger3", "group1", "job3", "group1",
new Date(ts), null, 10, 10000L);
ft = sched.scheduleJob(job, trigger);
log.info(job.getFullName() +
" will run at: " + ft +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
// the same job (job3) will be scheduled by a another trigger
// this time will only run every 70 seocnds (70000 ms)
trigger = new SimpleTrigger("trigger3", "group2", "job3", "group1",
new Date(ts), null, 2, 70000L);
ft = sched.scheduleJob(trigger);
log.info(job.getFullName() +
" will [also] run at: " + ft +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
// job4 will run 6 times (run once and repeat 5 more times)
// job4 will repeat every 10 seconds (10000 ms)
job = new JobDetail("job4", "group1", SimpleJob.class);
trigger = new SimpleTrigger("trigger4", "group1", "job4", "group1",
new Date(ts), null, 5, 10000L);
ft = sched.scheduleJob(job, trigger);
log.info(job.getFullName() +
" will run at: " + ft +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
// job5 will run once, five minutes past "ts" (300 seconds past "ts")
job = new JobDetail("job5", "group1", SimpleJob.class);
trigger = new SimpleTrigger("trigger5", "group1", "job5", "group1",
new Date(ts + 300000L), null, 0, 0);
ft = sched.scheduleJob(job, trigger);
log.info(job.getFullName() +
" will run at: " + ft +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
// job6 will run indefinitely, every 50 seconds
job = new JobDetail("job6", "group1", SimpleJob.class);
trigger = new SimpleTrigger("trigger6", "group1", "job6", "group1",
new Date(ts), null, SimpleTrigger.REPEAT_INDEFINITELY, 50000L);
ft = sched.scheduleJob(job, trigger);
log.info(job.getFullName() +
" will run at: " + ft +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
log.info("------- Starting Scheduler ----------------");
// All of the jobs have been added to the scheduler, but none of the jobs
// will run until the scheduler has been started
sched.start();
log.info("------- Started Scheduler -----------------");
// jobs can also be scheduled after start() has been called...
// job7 will repeat 20 times, repeat every five minutes
job = new JobDetail("job7", "group1", SimpleJob.class);
trigger = new SimpleTrigger("trigger7", "group1", "job7", "group1",
new Date(ts), null, 20, 300000L);
ft = sched.scheduleJob(job, trigger);
log.info(job.getFullName() +
" will run at: " + ft +
" and repeat: " + trigger.getRepeatCount() +
" times, every " + trigger.getRepeatInterval() / 1000 + " seconds");
// jobs can be fired directly... (rather than waiting for a trigger)
job = new JobDetail("job8", "group1", SimpleJob.class);
job.setDurability(true);
sched.addJob(job, true);
log.info("'Manually' triggering job8...");
sched.triggerJob("job8", "group1");
log.info("------- Waiting 30 seconds... --------------");
try {
// wait 30 seconds to show jobs
Thread.sleep(30L * 1000L);
// executing...
} catch (Exception e) {
}
// jobs can be re-scheduled...
// job 7 will run immediately and repeat 10 times for every second
log.info("------- Rescheduling... --------------------");
trigger = new SimpleTrigger("trigger7", "group1", "job7", "group1",
new Date(), null, 10, 1000L);
ft = sched.rescheduleJob("trigger7", "group1", trigger);
log.info("job7 rescheduled to run at: " + ft);
log.info("------- Waiting five minutes... ------------");
try {
// wait five minutes to show jobs
Thread.sleep(300L * 1000L);
// executing...
} catch (Exception e) {
}
log.info("------- Shutting Down ---------------------");
sched.shutdown(true);
log.info("------- Shutdown Complete -----------------");
// display some stats about the schedule that just ran
SchedulerMetaData metaData = sched.getMetaData();
log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
}
public static void main(String[] args) throws Exception {
SimpleTriggerExample example = new SimpleTriggerExample();
example.run();
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example14/ 0000755 0001750 0001750 00000000000 11623033643 027361 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example14/TriggerEchoJob.java 0000644 0001750 0001750 00000003423 11302067147 033063 0 ustar twerner twerner /*
* Copyright 2006-2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example14;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
* This is just a simple job that echos the name of the Trigger
* that fired it.
*/
public class TriggerEchoJob implements Job {
private static final Log LOG = LogFactory.getLog(TriggerEchoJob.class);
/**
* Empty constructor for job initilization
*
*
* Quartz requires a public empty constructor so that the
* scheduler can instantiate the class whenever it needs.
*
*/
public TriggerEchoJob() {
}
/**
*
* Called by the {@link org.quartz.Scheduler}
when a
* {@link org.quartz.Trigger}
fires that is associated with
* the Job
.
*
*
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException {
LOG.info("TRIGGER: " + context.getTrigger().getName());
}
} libquartz-java-1.7.3.orig/examples/src/main/java/org/quartz/examples/example14/PriorityExample.java 0000644 0001750 0001750 00000010374 11302067147 033366 0 ustar twerner twerner /*
* Copyright 2006-2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz.examples.example14;
import java.util.Calendar;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.SimpleTrigger;
import org.quartz.impl.StdSchedulerFactory;
/**
* This Example will demonstrate how Triggers are ordered by priority.
*/
public class PriorityExample {
public void run() throws Exception {
Log log = LogFactory.getLog(PriorityExample.class);
log.info("------- Initializing ----------------------");
// First we must get a reference to a scheduler
SchedulerFactory sf = new StdSchedulerFactory(
"org/quartz/examples/example14/quartz_priority.properties");
Scheduler sched = sf.getScheduler();
log.info("------- Initialization Complete -----------");
log.info("------- Scheduling Jobs -------------------");
JobDetail job = new JobDetail("TriggerEchoJob", null, TriggerEchoJob.class);
// All three triggers will fire their first time at the same time,
// ordered by their priority, and then repeat once, firing in a
// staggered order that therefore ignores priority.
//
// We should see the following firing order:
// 1. Priority10Trigger15SecondRepeat
// 2. Priority5Trigger10SecondRepeat
// 3. PriorityNeg5Trigger5SecondRepeat
// 4. PriorityNeg5Trigger5SecondRepeat
// 5. Priority5Trigger10SecondRepeat
// 6. Priority10Trigger15SecondRepeat
// Calculate the start time of all triggers as 5 seconds from now
Calendar startTime = Calendar.getInstance();
startTime.add(Calendar.SECOND, 5);
// First trigger has priority of 1, and will repeat after 5 seconds
SimpleTrigger trigger1 =
new SimpleTrigger("PriorityNeg5Trigger5SecondRepeat", null, startTime.getTime(), null, 1, 5L * 1000L);
trigger1.setPriority(1);
trigger1.setJobName("TriggerEchoJob");
// Second trigger has default priority of 5, and will repeat after 10 seconds
SimpleTrigger trigger2 =
new SimpleTrigger("Priority5Trigger10SecondRepeat", null, startTime.getTime(), null, 1, 10L * 1000L);
trigger2.setJobName("TriggerEchoJob");
// Third trigger has priority 10, and will repeat after 15 seconds
SimpleTrigger trigger3 =
new SimpleTrigger("Priority10Trigger15SecondRepeat", null, startTime.getTime(), null, 1, 15L * 1000L);
trigger3.setPriority(10);
trigger3.setJobName("TriggerEchoJob");
// Tell quartz to schedule the job using our trigger
sched.scheduleJob(job, trigger1);
sched.scheduleJob(trigger2);
sched.scheduleJob(trigger3);
// Start up the scheduler (nothing can actually run until the
// scheduler has been started)
sched.start();
log.info("------- Started Scheduler -----------------");
// wait long enough so that the scheduler as an opportunity to
// fire the triggers
log.info("------- Waiting 30 seconds... -------------");
try {
Thread.sleep(30L * 1000L);
// executing...
} catch (Exception e) {
}
// shut down the scheduler
log.info("------- Shutting Down ---------------------");
sched.shutdown(true);
log.info("------- Shutdown Complete -----------------");
}
public static void main(String[] args) throws Exception {
PriorityExample example = new PriorityExample();
example.run();
}
} libquartz-java-1.7.3.orig/examples/example3/ 0000755 0001750 0001750 00000000000 11623033644 020711 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/example3/cron_triggers_readme.txt 0000644 0001750 0001750 00000000753 10265024000 025626 0 ustar twerner twerner Example 3
=========
Overview:
=========
This example will demonstrate how to use Cron Triggers.
Running the Example:
====================
1. Windows users - Modify the example3.bat file (if necessary)
to set your JAVA_HOME. Run example3.bat
2. UNIX/Linux users - Modify the example3.sh file (if necessary)
to set your JAVA_HOME. Execute example3.sh
Configuration Files:
====================
1. You can decide to specify a log4j.properties file to
control logging output (optional)
libquartz-java-1.7.3.orig/examples/example3/log4j.xml 0000755 0001750 0001750 00000001165 10276303016 022454 0 ustar twerner twerner
libquartz-java-1.7.3.orig/examples/example3/example3.sh 0000755 0001750 0001750 00000000642 11332420531 022760 0 ustar twerner twerner #!/bin/sh
# Change this to your JDK installation root
#
#JAVA_HOME=/usr/java/j2sdk1.4.0_01
JRE=$JAVA_HOME/jre
JAVA=$JRE/bin/java
QUARTZ=../..
. ${QUARTZ}/examples/bin/buildcp.sh
# Uncomment the following line if you would like to set log4j
# logging properties
#
#LOGGING_PROPS="-Dlog4j.configuration=log4j.properties"
$JAVA -classpath $QUARTZ_CP $LOGGING_PROPS org.quartz.examples.example3.CronTriggerExample
libquartz-java-1.7.3.orig/examples/example3/example3.bat 0000644 0001750 0001750 00000001212 10265024000 023076 0 ustar twerner twerner @echo off
rem Set Quartz to the base directory of the Quartz Distribution
@SET QUARTZ=..\..
@rem setup the class path...
CALL ..\bin\buildcp.bat
SET QUARTZ_CP=%TMP_CP%
rem !!!!!!! Please read important information. !!!!!!
rem If "java" is not in your path, please set the path
rem for Java 2 Runtime Environment in the path variable below
rem for example :
rem @SET PATH=D:\jdk1.3.1;%PATH%
rem
rem Set LOG4J props if you are interested in setting up
rem a configuraiton file for log4j logging
rem @SET LOG4J_PROPS="-Dlog4j.configuration=log4j.properties"
"java" -cp "%QUARTZ_CP%" %LOG4J_PROPS% org.quartz.examples.example3.CronTriggerExample
libquartz-java-1.7.3.orig/examples/example7/ 0000755 0001750 0001750 00000000000 11623033643 020714 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/example7/example7.bat 0000644 0001750 0001750 00000001210 10265024000 023104 0 ustar twerner twerner @echo off
rem Set Quartz to the base directory of the Quartz Distribution
@SET QUARTZ=..\..
@rem setup the class path...
CALL ..\bin\buildcp.bat
SET QUARTZ_CP=%TMP_CP%
rem !!!!!!! Please read important information. !!!!!!
rem If "java" is not in your path, please set the path
rem for Java 2 Runtime Environment in the path variable below
rem for example :
rem @SET PATH=D:\jdk1.3.1;%PATH%
rem
rem Set LOG4J props if you are interested in setting up
rem a configuraiton file for log4j logging
rem @SET LOG4J_PROPS="-Dlog4j.configuration=log4j.properties"
"java" -cp "%QUARTZ_CP%" %LOG4J_PROPS% org.quartz.examples.example7.InterruptExample
libquartz-java-1.7.3.orig/examples/example7/log4j.xml 0000755 0001750 0001750 00000001165 10276303016 022460 0 ustar twerner twerner
libquartz-java-1.7.3.orig/examples/example7/interrupting_readme.txt 0000644 0001750 0001750 00000001011 10265024000 025501 0 ustar twerner twerner Example 7
=========
Overview:
=========
This example will demonstrate how the scheduler can interrupt
jobs running in Quartz.
Running the Example:
====================
1. Windows users - Modify the example7.bat file (if necessary)
to set your JAVA_HOME. Run example7.bat
2. UNIX/Linux users - Modify the example7.sh file (if necessary)
to set your JAVA_HOME. Execute example7.sh
Configuration Files:
====================
1. You can decide to specify a log4j.properties file to
control logging output (optional)
libquartz-java-1.7.3.orig/examples/example7/example7.sh 0000755 0001750 0001750 00000000640 11332420531 022766 0 ustar twerner twerner #!/bin/sh
# Change this to your JDK installation root
#
#JAVA_HOME=/usr/java/j2sdk1.4.0_01
JRE=$JAVA_HOME/jre
JAVA=$JRE/bin/java
QUARTZ=../..
. ${QUARTZ}/examples/bin/buildcp.sh
# Uncomment the following line if you would like to set log4j
# logging properties
#
#LOGGING_PROPS="-Dlog4j.configuration=log4j.properties"
$JAVA -classpath $QUARTZ_CP $LOGGING_PROPS org.quartz.examples.example7.InterruptExample
libquartz-java-1.7.3.orig/examples/example13/ 0000755 0001750 0001750 00000000000 11623033644 020772 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/example13/instance1.properties 0000644 0001750 0001750 00000006336 10265024000 024770 0 ustar twerner twerner
#============================================================================
# Configure Main Scheduler Properties
#============================================================================
org.quartz.scheduler.instanceName = TestScheduler
org.quartz.scheduler.instanceId = instance_one
#============================================================================
# Configure ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 5
org.quartz.threadPool.threadPriority = 5
#============================================================================
# Configure JobStore
#============================================================================
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
org.quartz.jobStore.useProperties=false
org.quartz.jobStore.dataSource=myDS
org.quartz.jobStore.tablePrefix=QRTZ_
org.quartz.jobStore.isClustered=true
#============================================================================
# Other Example Delegates
#============================================================================
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.CloudscapeDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.DB2v6Delegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.DB2v7Delegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.DriverDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.HSQLDBDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.MSSQLDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PointbaseDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.WebLogicDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.WebLogicOracleDelegate
#============================================================================
# Configure Datasources
#============================================================================
org.quartz.dataSource.myDS.driver = org.postgresql.Driver
org.quartz.dataSource.myDS.URL = jdbc:postgresql://localhost:5432/quartz
org.quartz.dataSource.myDS.user = quartz
org.quartz.dataSource.myDS.password = quartz
org.quartz.dataSource.myDS.maxConnections = 5
org.quartz.dataSource.myDS.validationQuery=
#============================================================================
# Configure Plugins
#============================================================================
#org.quartz.plugin.shutdownHook.class = org.quartz.plugins.management.ShutdownHookPlugin
#org.quartz.plugin.shutdownHook.cleanShutdown = true
#org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin
libquartz-java-1.7.3.orig/examples/example13/instance1.bat 0000644 0001750 0001750 00000001576 10265024000 023343 0 ustar twerner twerner @echo off
rem Set Quartz to the base directory of the Quartz Distribution
@SET QUARTZ=..\..
@rem setup the class path...
CALL ..\bin\buildcp.bat
SET QUARTZ_CP=%TMP_CP%
rem !!!!!!! Please read important information. !!!!!!
rem If "java" is not in your path, please set the path
rem for Java 2 Runtime Environment in the path variable below
rem for example :
rem @SET PATH=D:\jdk1.3.1;%PATH%
rem
rem Set LOG4J props if you are interested in setting up
rem a configuraiton file for log4j logging
rem @SET LOG4J_PROPS="-Dlog4j.configuration=log4j.properties"
rem Set the location and name of the quartz.properties file
@SET QUARTZ_PROPS="-Dorg.quartz.properties=instance1.properties"
rem Put the path to your JDBC driver(s) in this variable
@SET JDBC_CP=..\..\lib\postgres.jar
"java" -cp "%QUARTZ_CP%;%JDBC_CP%" %QUARTZ_PROPS% %LOG4J_PROPS% org.quartz.examples.example13.ClusterExample %1
libquartz-java-1.7.3.orig/examples/example13/instance2.bat 0000644 0001750 0001750 00000001614 10265024000 023335 0 ustar twerner twerner @echo off
rem Set Quartz to the base directory of the Quartz Distribution
@SET QUARTZ=..\..
@rem setup the class path...
CALL ..\bin\buildcp.bat
SET QUARTZ_CP=%TMP_CP%
rem !!!!!!! Please read important information. !!!!!!
rem If "java" is not in your path, please set the path
rem for Java 2 Runtime Environment in the path variable below
rem for example :
rem @SET PATH=D:\jdk1.3.1;%PATH%
rem
rem Set LOG4J props if you are interested in setting up
rem a configuraiton file for log4j logging
rem @SET LOG4J_PROPS="-Dlog4j.configuration=log4j.properties"
rem Set the location and name of the quartz.properties file
@SET QUARTZ_PROPS="-Dorg.quartz.properties=instance2.properties"
rem Put the path to your JDBC driver(s) in this variable
@SET JDBC_CP=..\..\lib\postgres.jar
"java" -cp "%QUARTZ_CP%;%JDBC_CP%" %QUARTZ_PROPS% %LOG4J_PROPS% org.quartz.examples.example13.ClusterExample dontScheduleJobs
libquartz-java-1.7.3.orig/examples/example13/log4j.xml 0000755 0001750 0001750 00000001165 10276303016 022535 0 ustar twerner twerner
libquartz-java-1.7.3.orig/examples/example13/instance1.sh 0000755 0001750 0001750 00000001236 11332420531 023210 0 ustar twerner twerner #!/bin/sh
# Change this to your JDK installation root
#
#JAVA_HOME=/usr/java/j2sdk1.4.0_01
JRE=$JAVA_HOME/jre
JAVA=$JRE/bin/java
QUARTZ=../..
. ${QUARTZ}/examples/bin/buildcp.sh
#
# Set the path to your JDCB Driver jar file here
JDBC_CP=/home/user/lib/postgres.jar
QUARTZ_CP=$QUARTZ_CP:$JDBC_CP
# Uncomment the following line if you would like to set log4j
# logging properties
#
#LOGGING_PROPS="-Dlog4j.configuration=log4j.properties"
# Set the name and location of the quartz.properties file
QUARTZ_PROPS="-Dorg.quartz.properties=instance1.properties"
$JAVA -classpath $QUARTZ_CP $QUARTZ_PROPS $LOGGING_PROPS org.quartz.examples.example13.ClusterExample $1
libquartz-java-1.7.3.orig/examples/example13/clustering_readme.txt 0000644 0001750 0001750 00000005551 10265024000 025220 0 ustar twerner twerner Example 13
==========
Overview:
=========
This example demonstrates how Quartz can be used in a clustered
environment to support failover. In a clustered environment, you
are running multiple instances of Quartz using a shared scheduler.
This shared scheduler is persisted in a database, so that both
instances can share the same scheduling data.
Note: This example works best when you run the client and server on
different computers. However, you can certainly run the server and
the client on the same box!
Running the Example:
====================
1. Configure the instance1.properties file and the instance2.properties
file as necesary (see the "Configuration" section below for details).
2. Windows users - Modify instance1.bat and instance2.bat (if necessary)
to set your JAVA_HOME and your JDBC_CP. Run instance1.bat. Once the
first instance is started, run instance2.bat (note: these may or may not be
on the same box!)
3. UNIX/Linux users - Modify instance1.sh and instance2.sh (if necessary)
to set your JAVA_HOME and your JDBC_CP. Execute instance1.sh. Once
the first instance is started, run instance2.sh (note: these may or may
not be on the same box!)
Note: If you have access to both Windows boxes and UNIX/Linux boxes, try
running the example on different platforms!
Note: You may pass the "clearJobs" argument to your batch file or script
for instance 1 to clear all existing jobs in the database before executing.
Note: The script or batch file for instance two automatically uses the
parameter "dontScheduleJobs" this allows instance 1 to do the job scheduling
and that instance 2 will not reschedule the same jobs on start up.
Configuration:
==============
1. You can decide to specify a log4j.properties file to control logging
output (optional)
2. This example uses a database to maintain scheduling information in a
clustered environment. You will need to first install the Quartz
database tables. SQL table creation scripts are included with the Quartz
distribution for many popular database platforms.
3. After you have installed the database scripts, you will need to
configure both properties file so that Quartz knows how to connect to
your database.
The following parameters need to be set: (this shows a PostgreSQL example)
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
org.quartz.jobStore.useProperties=false
org.quartz.jobStore.dataSource=myDS
org.quartz.jobStore.tablePrefix=QRTZ_
org.quartz.jobStore.isClustered=true
org.quartz.dataSource.myDS.driver = org.postgresql.Driver
org.quartz.dataSource.myDS.URL = jdbc:postgresql://localhost:5432/quartz
org.quartz.dataSource.myDS.user = quartz
org.quartz.dataSource.myDS.password = quartz
org.quartz.dataSource.myDS.maxConnections = 5
org.quartz.dataSource.myDS.validationQuery=
libquartz-java-1.7.3.orig/examples/example13/instance2.properties 0000644 0001750 0001750 00000006336 10265024000 024771 0 ustar twerner twerner
#============================================================================
# Configure Main Scheduler Properties
#============================================================================
org.quartz.scheduler.instanceName = TestScheduler
org.quartz.scheduler.instanceId = instance_two
#============================================================================
# Configure ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 5
org.quartz.threadPool.threadPriority = 5
#============================================================================
# Configure JobStore
#============================================================================
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
org.quartz.jobStore.useProperties=false
org.quartz.jobStore.dataSource=myDS
org.quartz.jobStore.tablePrefix=QRTZ_
org.quartz.jobStore.isClustered=true
#============================================================================
# Other Example Delegates
#============================================================================
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.CloudscapeDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.DB2v6Delegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.DB2v7Delegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.DriverDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.HSQLDBDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.MSSQLDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PointbaseDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.WebLogicDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.WebLogicOracleDelegate
#============================================================================
# Configure Datasources
#============================================================================
org.quartz.dataSource.myDS.driver = org.postgresql.Driver
org.quartz.dataSource.myDS.URL = jdbc:postgresql://localhost:5432/quartz
org.quartz.dataSource.myDS.user = quartz
org.quartz.dataSource.myDS.password = quartz
org.quartz.dataSource.myDS.maxConnections = 5
org.quartz.dataSource.myDS.validationQuery=
#============================================================================
# Configure Plugins
#============================================================================
#org.quartz.plugin.shutdownHook.class = org.quartz.plugins.management.ShutdownHookPlugin
#org.quartz.plugin.shutdownHook.cleanShutdown = true
#org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin
libquartz-java-1.7.3.orig/examples/example13/instance2.sh 0000755 0001750 0001750 00000001255 11332420531 023212 0 ustar twerner twerner #!/bin/sh
# Change this to your JDK installation root
#
#JAVA_HOME=/usr/java/j2sdk1.4.0_01
JRE=$JAVA_HOME/jre
JAVA=$JRE/bin/java
QUARTZ=../..
. ${QUARTZ}/examples/bin/buildcp.sh
#
# Set the path to your JDCB Driver jar file here
JDBC_CP=/home/user/lib/postgres.jar
QUARTZ_CP=$QUARTZ_CP:$JDBC_CP
# Uncomment the following line if you would like to set log4j
# logging properties
#
#LOGGING_PROPS="-Dlog4j.configuration=log4j.properties"
# Set the name and location of the quartz.properties file
QUARTZ_PROPS="-Dorg.quartz.properties=instance2.properties"
$JAVA -classpath $QUARTZ_CP $QUARTZ_PROPS $LOGGING_PROPS org.quartz.examples.example13.ClusterExample dontScheduleJobs
libquartz-java-1.7.3.orig/examples/example10/ 0000755 0001750 0001750 00000000000 11623033644 020767 5 ustar twerner twerner libquartz-java-1.7.3.orig/examples/example10/log4j.xml 0000755 0001750 0001750 00000001165 10276303016 022532 0 ustar twerner twerner
libquartz-java-1.7.3.orig/examples/example10/plugins_readme.txt 0000644 0001750 0001750 00000001242 10265024000 024510 0 ustar twerner twerner Example 10
==========
Overview:
=========
This example demonstrates how to use Job Listeners in
Quartz to have the completion of one job trigger another job.
Running the Example:
====================
1. Windows users - Modify the example10.bat file (if necessary)
to set your JAVA_HOME. Run example10.bat
2. UNIX/Linux users - Modify the example10.sh file (if necessary)
to set your JAVA_HOME. Execute example10.sh
Configuration Files:
====================
1. You can decide to specify a log4j.properties file to
control logging output (optional)
2. This example uses the quartz.properties file to configure
quartz to use the jobs.xml file for job configuration
libquartz-java-1.7.3.orig/examples/example10/example10.sh 0000755 0001750 0001750 00000001040 11332420531 023105 0 ustar twerner twerner #!/bin/sh
# Change this to your JDK installation root
#
#JAVA_HOME=/usr/java/j2sdk1.4.0_01
JRE=$JAVA_HOME/jre
JAVA=$JRE/bin/java
QUARTZ=../..
. ${QUARTZ}/examples/bin/buildcp.sh
# Uncomment the following line if you would like to set log4j
# logging properties
#
#LOGGING_PROPS="-Dlog4j.configuration=log4j.properties"
# Set the name and location of the quartz.properties file
QUARTZ_PROPS="-Dorg.quartz.properties=quartz.properties"
$JAVA -classpath $QUARTZ_CP $QUARTZ_PROPS $LOGGING_PROPS org.quartz.examples.example10.PlugInExample
libquartz-java-1.7.3.orig/examples/example10/quartz.properties 0000644 0001750 0001750 00000004404 10401647723 024437 0 ustar twerner twerner
#============================================================================
# Configure Main Scheduler Properties
#============================================================================
org.quartz.scheduler.instanceName = TestScheduler
org.quartz.scheduler.instanceId = AUTO
#============================================================================
# Configure ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 3
org.quartz.threadPool.threadPriority = 5
#============================================================================
# Configure JobStore
#============================================================================
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
#org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
#org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
#org.quartz.jobStore.useProperties = false
#org.quartz.jobStore.dataSource = myDS
#org.quartz.jobStore.tablePrefix = QRTZ_
#org.quartz.jobStore.isClustered = false
#============================================================================
# Configure Datasources
#============================================================================
#org.quartz.dataSource.myDS.driver = org.postgresql.Driver
#org.quartz.dataSource.myDS.URL = jdbc:postgresql://localhost/dev
#org.quartz.dataSource.myDS.user = jhouse
#org.quartz.dataSource.myDS.password =
#org.quartz.dataSource.myDS.maxConnections = 5
#============================================================================
# Configure Plugins
#============================================================================
org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin
org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
org.quartz.plugin.jobInitializer.fileNames = jobs.xml
org.quartz.plugin.jobInitializer.overWriteExistingJobs = true
org.quartz.plugin.jobInitializer.failOnFileNotFound = true
org.quartz.plugin.jobInitializer.scanInterval = 10
org.quartz.plugin.jobInitializer.wrapInUserTransaction = false libquartz-java-1.7.3.orig/examples/example10/jobs.xml 0000644 0001750 0001750 00000005230 11332420531 022436 0 ustar twerner twerner
holidayCalendar
HolidayCalendar
weeklyCalendar
WeeklyCalendar
annualCalendar
AnnualCalendar
testJob1
testJobs
Test Job Number 1
org.quartz.examples.example10.SimpleJob
false
false
false
test1
test1
test2
test2
testTrigger1
testJobs
Test Trigger Number 1
testJob1
testJobs
0/15 * * ? * *
testJob2
testJobs
Test Job Number 2
org.quartz.examples.example10.SimpleJob
false
false
false
testTrigger2
testJobs
Test Trigger Number 2
holidayCalendar
testJob2
testJobs
2004-02-26T12:26:00
10
5000
libquartz-java-1.7.3.orig/examples/example10/example10.bat 0000644 0001750 0001750 00000001417 10265024000 023241 0 ustar twerner twerner @echo off
rem Set Quartz to the base directory of the Quartz Distribution
@SET QUARTZ=..\..
@rem setup the class path...
CALL ..\bin\buildcp.bat
SET QUARTZ_CP=%TMP_CP%
rem !!!!!!! Please read important information. !!!!!!
rem If "java" is not in your path, please set the path
rem for Java 2 Runtime Environment in the path variable below
rem for example :
rem @SET PATH=D:\jdk1.3.1;%PATH%
rem
rem Set LOG4J props if you are interested in setting up
rem a configuraiton file for log4j logging
rem @SET LOG4J_PROPS="-Dlog4j.configuration=log4j.properties"
rem Set the location and name of the quartz.properties file
@SET QUARTZ_PROPS="-Dorg.quartz.properties=quartz.properties"
"java" -cp "%QUARTZ_CP%" %QUARTZ_PROPS% %LOG4J_PROPS% org.quartz.examples.example10.PlugInExample
libquartz-java-1.7.3.orig/examples/build.xml 0000644 0001750 0001750 00000003115 10407556670 021024 0 ustar twerner twerner