1. /*
  2. * Copyright 2005 - 2009 Terracotta, Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy
  6. * of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations
  14. * under the License.
  15. *
  16. */
  17.  
  18. package org.quartz.examples.example4;
  19.  
  20. import java.util.Date;
  21.  
  22. import org.slf4j.Logger;
  23. import org.slf4j.LoggerFactory;
  24. import org.quartz.JobDataMap;
  25. import org.quartz.JobExecutionContext;
  26. import org.quartz.JobExecutionException;
  27. import org.quartz.StatefulJob;
  28.  
  29. /**
  30. * <p>
  31. * This is just a simple job that receives parameters and
  32. * maintains state
  33. * </p>
  34. *
  35. * @author Bill Kratzer
  36. */
  37. public class ColorJob implements StatefulJob {
  38.  
  39. private static Logger _log = LoggerFactory.getLogger(ColorJob.class);
  40.  
  41. // parameter names specific to this job
  42. public static final String FAVORITE_COLOR = "favorite color";
  43. public static final String EXECUTION_COUNT = "count";
  44.  
  45. // Since Quartz will re-instantiate a class every time it
  46. // gets executed, members non-static member variables can
  47. // not be used to maintain state!
  48. private int _counter = 1;
  49.  
  50. /**
  51. * <p>
  52. * Empty constructor for job initilization
  53. * </p>
  54. * <p>
  55. * Quartz requires a public empty constructor so that the
  56. * scheduler can instantiate the class whenever it needs.
  57. * </p>
  58. */
  59. public ColorJob() {
  60. }
  61.  
  62. /**
  63. * <p>
  64. * Called by the <code>{@link org.quartz.Scheduler}</code> when a
  65. * <code>{@link org.quartz.Trigger}</code> fires that is associated with
  66. * the <code>Job</code>.
  67. * </p>
  68. *
  69. * @throws JobExecutionException
  70. * if there is an exception while executing the job.
  71. */
  72. public void execute(JobExecutionContext context)
  73. throws JobExecutionException {
  74.  
  75. // This job simply prints out its job name and the
  76. // date and time that it is running
  77. String jobName = context.getJobDetail().getFullName();
  78.  
  79. // Grab and print passed parameters
  80. JobDataMap data = context.getJobDetail().getJobDataMap();
  81. String favoriteColor = data.getString(FAVORITE_COLOR);
  82. int count = data.getInt(EXECUTION_COUNT);
  83. _log.info("ColorJob: " + jobName + " executing at " + new Date() + "\n" +
  84. " favorite color is " + favoriteColor + "\n" +
  85. " execution count (from job map) is " + count + "\n" +
  86. " execution count (from job member variable) is " + _counter);
  87.  
  88. // increment the count and store it back into the
  89. // job map so that job state can be properly maintained
  90. count++;
  91. data.put(EXECUTION_COUNT, count);
  92.  
  93. // Increment the local member variable
  94. // This serves no real purpose since job state can not
  95. // be maintained via member variables!
  96. _counter++;
  97. }
  98.  
  99. }
  1. /*
  2. * Copyright 2005 - 2009 Terracotta, Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy
  6. * of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations
  14. * under the License.
  15. *
  16. */
  17.  
  18. package org.quartz.examples.example4;
  19.  
  20. import java.util.Date;
  21.  
  22. import org.slf4j.Logger;
  23. import org.slf4j.LoggerFactory;
  24. import org.quartz.JobDetail;
  25. import org.quartz.Scheduler;
  26. import org.quartz.SchedulerFactory;
  27. import org.quartz.SchedulerMetaData;
  28. import org.quartz.SimpleTrigger;
  29. import org.quartz.TriggerUtils;
  30. import org.quartz.impl.StdSchedulerFactory;
  31.  
  32. /**
  33. * This Example will demonstrate how job parameters can be
  34. * passed into jobs and how state can be maintained
  35. *
  36. * @author Bill Kratzer
  37. */
  38. public class JobStateExample {
  39.  
  40. public void run() throws Exception {
  41. Logger log = LoggerFactory.getLogger(JobStateExample.class);
  42.  
  43. log.info("------- Initializing -------------------");
  44.  
  45. // First we must get a reference to a scheduler
  46. SchedulerFactory sf = new StdSchedulerFactory();
  47. Scheduler sched = sf.getScheduler();
  48.  
  49. log.info("------- Initialization Complete --------");
  50.  
  51. log.info("------- Scheduling Jobs ----------------");
  52.  
  53. // get a "nice round" time a few seconds in the future....
  54. long ts = TriggerUtils.getNextGivenSecondDate(null, 10).getTime();
  55.  
  56. // job1 will only run 5 times, every 10 seconds
  57. JobDetail job1 = new JobDetail("job1", "group1", ColorJob.class);
  58. SimpleTrigger trigger1 = new SimpleTrigger("trigger1", "group1", "job1", "group1",
  59. new Date(ts), null, 4, 10000);
  60. // pass initialization parameters into the job
  61. job1.getJobDataMap().put(ColorJob.FAVORITE_COLOR, "Green");
  62. job1.getJobDataMap().put(ColorJob.EXECUTION_COUNT, 1);
  63.  
  64. // schedule the job to run
  65. Date scheduleTime1 = sched.scheduleJob(job1, trigger1);
  66. log.info(job1.getFullName() +
  67. " will run at: " + scheduleTime1 +
  68. " and repeat: " + trigger1.getRepeatCount() +
  69. " times, every " + trigger1.getRepeatInterval() / 1000 + " seconds");
  70.  
  71. // job2 will also run 5 times, every 10 seconds
  72. JobDetail job2 = new JobDetail("job2", "group1", ColorJob.class);
  73. SimpleTrigger trigger2 = new SimpleTrigger("trigger2", "group1", "job2", "group1",
  74. new Date(ts + 1000), null, 4, 10000);
  75. // pass initialization parameters into the job
  76. // this job has a different favorite color!
  77. job2.getJobDataMap().put(ColorJob.FAVORITE_COLOR, "Red");
  78. job2.getJobDataMap().put(ColorJob.EXECUTION_COUNT, 1);
  79.  
  80. // schedule the job to run
  81. Date scheduleTime2 = sched.scheduleJob(job2, trigger2);
  82. log.info(job2.getFullName() +
  83. " will run at: " + scheduleTime2 +
  84. " and repeat: " + trigger2.getRepeatCount() +
  85. " times, every " + trigger2.getRepeatInterval() / 1000 + " seconds");
  86.  
  87. log.info("------- Starting Scheduler ----------------");
  88.  
  89. // All of the jobs have been added to the scheduler, but none of the jobs
  90. // will run until the scheduler has been started
  91. sched.start();
  92.  
  93. log.info("------- Started Scheduler -----------------");
  94.  
  95. log.info("------- Waiting 60 seconds... -------------");
  96. try {
  97. // wait five minutes to show jobs
  98. Thread.sleep(60L * 1000L);
  99. // executing...
  100. } catch (Exception e) {
  101. }
  102.  
  103. log.info("------- Shutting Down ---------------------");
  104.  
  105. sched.shutdown(true);
  106.  
  107. log.info("------- Shutdown Complete -----------------");
  108.  
  109. SchedulerMetaData metaData = sched.getMetaData();
  110. log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
  111.  
  112. }
  113.  
  114. public static void main(String[] args) throws Exception {
  115.  
  116. JobStateExample example = new JobStateExample();
  117. example.run();
  118. }
  119.  
  120. }

  

  1. /*
  2. * Copyright 2005 - 2009 Terracotta, Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy
  6. * of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations
  14. * under the License.
  15. *
  16. */
  17.  
  18. package org.quartz.examples.example4;
  19.  
  20. import java.util.Date;
  21.  
  22. import org.slf4j.Logger;
  23. import org.slf4j.LoggerFactory;
  24. import org.quartz.JobDetail;
  25. import org.quartz.Scheduler;
  26. import org.quartz.SchedulerFactory;
  27. import org.quartz.SchedulerMetaData;
  28. import org.quartz.SimpleTrigger;
  29. import org.quartz.TriggerUtils;
  30. import org.quartz.impl.StdSchedulerFactory;
  31.  
  32. /**
  33. * This Example will demonstrate how job parameters can be
  34. * passed into jobs and how state can be maintained
  35. *
  36. * @author Bill Kratzer
  37. */
  38. public class JobStateExample {
  39.  
  40. public void run() throws Exception {
  41. Logger log = LoggerFactory.getLogger(JobStateExample.class);
  42.  
  43. log.info("------- Initializing -------------------");
  44.  
  45. // First we must get a reference to a scheduler
  46. SchedulerFactory sf = new StdSchedulerFactory();
  47. Scheduler sched = sf.getScheduler();
  48.  
  49. log.info("------- Initialization Complete --------");
  50.  
  51. log.info("------- Scheduling Jobs ----------------");
  52.  
  53. // get a "nice round" time a few seconds in the future....
  54. long ts = TriggerUtils.getNextGivenSecondDate(null, 10).getTime();
  55.  
  56. // job1 will only run 5 times, every 10 seconds
  57. JobDetail job1 = new JobDetail("job1", "group1", ColorJob.class);
  58. SimpleTrigger trigger1 = new SimpleTrigger("trigger1", "group1", "job1", "group1",
  59. new Date(ts), null, 4, 10000);
  60. // pass initialization parameters into the job
  61. job1.getJobDataMap().put(ColorJob.FAVORITE_COLOR, "Green");
  62. job1.getJobDataMap().put(ColorJob.EXECUTION_COUNT, 1);
  63.  
  64. // schedule the job to run
  65. Date scheduleTime1 = sched.scheduleJob(job1, trigger1);
  66. log.info(job1.getFullName() +
  67. " will run at: " + scheduleTime1 +
  68. " and repeat: " + trigger1.getRepeatCount() +
  69. " times, every " + trigger1.getRepeatInterval() / 1000 + " seconds");
  70.  
  71. // job2 will also run 5 times, every 10 seconds
  72. JobDetail job2 = new JobDetail("job2", "group1", ColorJob.class);
  73. SimpleTrigger trigger2 = new SimpleTrigger("trigger2", "group1", "job2", "group1",
  74. new Date(ts + 1000), null, 4, 10000);
  75. // pass initialization parameters into the job
  76. // this job has a different favorite color!
  77. job2.getJobDataMap().put(ColorJob.FAVORITE_COLOR, "Red");
  78. job2.getJobDataMap().put(ColorJob.EXECUTION_COUNT, 1);
  79.  
  80. // schedule the job to run
  81. Date scheduleTime2 = sched.scheduleJob(job2, trigger2);
  82. log.info(job2.getFullName() +
  83. " will run at: " + scheduleTime2 +
  84. " and repeat: " + trigger2.getRepeatCount() +
  85. " times, every " + trigger2.getRepeatInterval() / 1000 + " seconds");
  86.  
  87. log.info("------- Starting Scheduler ----------------");
  88.  
  89. // All of the jobs have been added to the scheduler, but none of the jobs
  90. // will run until the scheduler has been started
  91. sched.start();
  92.  
  93. log.info("------- Started Scheduler -----------------");
  94.  
  95. log.info("------- Waiting 60 seconds... -------------");
  96. try {
  97. // wait five minutes to show jobs
  98. Thread.sleep(60L * 1000L);
  99. // executing...
  100. } catch (Exception e) {
  101. }
  102.  
  103. log.info("------- Shutting Down ---------------------");
  104.  
  105. sched.shutdown(true);
  106.  
  107. log.info("------- Shutdown Complete -----------------");
  108.  
  109. SchedulerMetaData metaData = sched.getMetaData();
  110. log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs.");
  111.  
  112. }
  113.  
  114. public static void main(String[] args) throws Exception {
  115.  
  116. JobStateExample example = new JobStateExample();
  117. example.run();
  118. }
  119.  
  120. }

  

  1. [INFO] 02 二月 01:49:30.844 下午 main [org.quartz.examples.example4.JobStateExample]
  2. ------- Initializing -------------------
  3.  
  4. [INFO] 02 二月 01:49:30.868 下午 main [org.quartz.simpl.SimpleThreadPool]
  5. Job execution threads will use class loader of thread: main
  6.  
  7. [INFO] 02 二月 01:49:30.881 下午 main [org.quartz.core.SchedulerSignalerImpl]
  8. Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
  9.  
  10. [INFO] 02 二月 01:49:30.882 下午 main [org.quartz.core.QuartzScheduler]
  11. Quartz Scheduler v.1.8.5 created.
  12.  
  13. [INFO] 02 二月 01:49:30.884 下午 main [org.quartz.simpl.RAMJobStore]
  14. RAMJobStore initialized.
  15.  
  16. [INFO] 02 二月 01:49:30.884 下午 main [org.quartz.core.QuartzScheduler]
  17. Scheduler meta-data: Quartz Scheduler (v1.8.5) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED'
  18. Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
  19. NOT STARTED.
  20. Currently in standby mode.
  21. Number of jobs executed: 0
  22. Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
  23. Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
  24.  
  25. [INFO] 02 二月 01:49:30.884 下午 main [org.quartz.impl.StdSchedulerFactory]
  26. Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
  27.  
  28. [INFO] 02 二月 01:49:30.885 下午 main [org.quartz.impl.StdSchedulerFactory]
  29. Quartz scheduler version: 1.8.5
  30.  
  31. [INFO] 02 二月 01:49:30.885 下午 main [org.quartz.examples.example4.JobStateExample]
  32. ------- Initialization Complete --------
  33.  
  34. [INFO] 02 二月 01:49:30.885 下午 main [org.quartz.examples.example4.JobStateExample]
  35. ------- Scheduling Jobs ----------------
  36.  
  37. [INFO] 02 二月 01:49:30.890 下午 main [org.quartz.examples.example4.JobStateExample]
  38. group1.job1 will run at: Tue Feb 02 13:49:40 CST 2016 and repeat: 4 times, every 10 seconds
  39.  
  40. [INFO] 02 二月 01:49:30.890 下午 main [org.quartz.examples.example4.JobStateExample]
  41. group1.job2 will run at: Tue Feb 02 13:49:41 CST 2016 and repeat: 4 times, every 10 seconds
  42.  
  43. [INFO] 02 二月 01:49:30.891 下午 main [org.quartz.examples.example4.JobStateExample]
  44. ------- Starting Scheduler ----------------
  45.  
  46. [INFO] 02 二月 01:49:30.891 下午 main [org.quartz.core.QuartzScheduler]
  47. Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
  48.  
  49. [INFO] 02 二月 01:49:30.891 下午 main [org.quartz.examples.example4.JobStateExample]
  50. ------- Started Scheduler -----------------
  51.  
  52. [INFO] 02 二月 01:49:30.891 下午 main [org.quartz.examples.example4.JobStateExample]
  53. ------- Waiting 60 seconds... -------------
  54.  
  55. [DEBUG] 02 二月 01:49:31.885 下午 Timer-0 [org.quartz.utils.UpdateChecker]
  56. Checking for available updated version of Quartz...
  57.  
  58. [DEBUG] 02 二月 01:49:40.008 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
  59. Producing instance of Job 'group1.job1', class=org.quartz.examples.example4.ColorJob
  60.  
  61. [DEBUG] 02 二月 01:49:40.026 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.core.JobRunShell]
  62. Calling execute on job group1.job1
  63.  
  64. [INFO] 02 二月 01:49:40.026 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.examples.example4.ColorJob]
  65. ColorJob: group1.job1 executing at Tue Feb 02 13:49:40 CST 2016
  66. favorite color is Green
  67. execution count (from job map) is 1
  68. execution count (from job member variable) is 1
  69.  
  70. [DEBUG] 02 二月 01:49:41.001 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
  71. Producing instance of Job 'group1.job2', class=org.quartz.examples.example4.ColorJob
  72.  
  73. [DEBUG] 02 二月 01:49:41.002 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.core.JobRunShell]
  74. Calling execute on job group1.job2
  75.  
  76. [INFO] 02 二月 01:49:41.002 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.examples.example4.ColorJob]
  77. ColorJob: group1.job2 executing at Tue Feb 02 13:49:41 CST 2016
  78. favorite color is Red
  79. execution count (from job map) is 1
  80. execution count (from job member variable) is 1
  81.  
  82. [DEBUG] 02 二月 01:49:50.000 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
  83. Producing instance of Job 'group1.job1', class=org.quartz.examples.example4.ColorJob
  84.  
  85. [DEBUG] 02 二月 01:49:50.000 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.core.JobRunShell]
  86. Calling execute on job group1.job1
  87.  
  88. [INFO] 02 二月 01:49:50.001 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.examples.example4.ColorJob]
  89. ColorJob: group1.job1 executing at Tue Feb 02 13:49:50 CST 2016
  90. favorite color is Green
  91. execution count (from job map) is 2
  92. execution count (from job member variable) is 1
  93.  
  94. [DEBUG] 02 二月 01:49:51.001 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
  95. Producing instance of Job 'group1.job2', class=org.quartz.examples.example4.ColorJob
  96.  
  97. [DEBUG] 02 二月 01:49:51.002 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.core.JobRunShell]
  98. Calling execute on job group1.job2
  99.  
  100. [INFO] 02 二月 01:49:51.002 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.examples.example4.ColorJob]
  101. ColorJob: group1.job2 executing at Tue Feb 02 13:49:51 CST 2016
  102. favorite color is Red
  103. execution count (from job map) is 2
  104. execution count (from job member variable) is 1
  105.  
  106. [DEBUG] 02 二月 01:50:00.000 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
  107. Producing instance of Job 'group1.job1', class=org.quartz.examples.example4.ColorJob
  108.  
  109. [DEBUG] 02 二月 01:50:00.001 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.core.JobRunShell]
  110. Calling execute on job group1.job1
  111.  
  112. [INFO] 02 二月 01:50:00.001 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.examples.example4.ColorJob]
  113. ColorJob: group1.job1 executing at Tue Feb 02 13:50:00 CST 2016
  114. favorite color is Green
  115. execution count (from job map) is 3
  116. execution count (from job member variable) is 1
  117.  
  118. [DEBUG] 02 二月 01:50:01.000 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
  119. Producing instance of Job 'group1.job2', class=org.quartz.examples.example4.ColorJob
  120.  
  121. [DEBUG] 02 二月 01:50:01.000 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.core.JobRunShell]
  122. Calling execute on job group1.job2
  123.  
  124. [INFO] 02 二月 01:50:01.001 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.examples.example4.ColorJob]
  125. ColorJob: group1.job2 executing at Tue Feb 02 13:50:01 CST 2016
  126. favorite color is Red
  127. execution count (from job map) is 3
  128. execution count (from job member variable) is 1
  129.  
  130. [DEBUG] 02 二月 01:50:10.001 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
  131. Producing instance of Job 'group1.job1', class=org.quartz.examples.example4.ColorJob
  132.  
  133. [DEBUG] 02 二月 01:50:10.001 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.core.JobRunShell]
  134. Calling execute on job group1.job1
  135.  
  136. [INFO] 02 二月 01:50:10.001 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.examples.example4.ColorJob]
  137. ColorJob: group1.job1 executing at Tue Feb 02 13:50:10 CST 2016
  138. favorite color is Green
  139. execution count (from job map) is 4
  140. execution count (from job member variable) is 1
  141.  
  142. [DEBUG] 02 二月 01:50:11.001 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
  143. Producing instance of Job 'group1.job2', class=org.quartz.examples.example4.ColorJob
  144.  
  145. [DEBUG] 02 二月 01:50:11.002 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.core.JobRunShell]
  146. Calling execute on job group1.job2
  147.  
  148. [INFO] 02 二月 01:50:11.002 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.examples.example4.ColorJob]
  149. ColorJob: group1.job2 executing at Tue Feb 02 13:50:11 CST 2016
  150. favorite color is Red
  151. execution count (from job map) is 4
  152. execution count (from job member variable) is 1
  153.  
  154. [DEBUG] 02 二月 01:50:20.000 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
  155. Producing instance of Job 'group1.job1', class=org.quartz.examples.example4.ColorJob
  156.  
  157. [DEBUG] 02 二月 01:50:20.000 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.core.JobRunShell]
  158. Calling execute on job group1.job1
  159.  
  160. [INFO] 02 二月 01:50:20.001 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.examples.example4.ColorJob]
  161. ColorJob: group1.job1 executing at Tue Feb 02 13:50:20 CST 2016
  162. favorite color is Green
  163. execution count (from job map) is 5
  164. execution count (from job member variable) is 1
  165.  
  166. [DEBUG] 02 二月 01:50:21.001 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
  167. Producing instance of Job 'group1.job2', class=org.quartz.examples.example4.ColorJob
  168.  
  169. [DEBUG] 02 二月 01:50:21.002 下午 DefaultQuartzScheduler_Worker-10 [org.quartz.core.JobRunShell]
  170. Calling execute on job group1.job2
  171.  
  172. [INFO] 02 二月 01:50:21.002 下午 DefaultQuartzScheduler_Worker-10 [org.quartz.examples.example4.ColorJob]
  173. ColorJob: group1.job2 executing at Tue Feb 02 13:50:21 CST 2016
  174. favorite color is Red
  175. execution count (from job map) is 5
  176. execution count (from job member variable) is 1
  177.  
  178. [INFO] 02 二月 01:50:30.905 下午 main [org.quartz.examples.example4.JobStateExample]
  179. ------- Shutting Down ---------------------
  180.  
  181. [INFO] 02 二月 01:50:30.906 下午 main [org.quartz.core.QuartzScheduler]
  182. Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutting down.
  183.  
  184. [INFO] 02 二月 01:50:30.906 下午 main [org.quartz.core.QuartzScheduler]
  185. Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED paused.
  186.  
  187. [DEBUG] 02 二月 01:50:30.907 下午 main [org.quartz.simpl.SimpleThreadPool]
  188. shutdown complete
  189.  
  190. [INFO] 02 二月 01:50:30.908 下午 main [org.quartz.core.QuartzScheduler]
  191. Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutdown complete.
  192.  
  193. [INFO] 02 二月 01:50:30.908 下午 main [org.quartz.examples.example4.JobStateExample]
  194. ------- Shutdown Complete -----------------
  195.  
  196. [INFO] 02 二月 01:50:30.909 下午 main [org.quartz.examples.example4.JobStateExample]
  197. Executed 10 jobs.
  198.  
  199. [DEBUG] 02 二月 01:50:31.029 下午 DefaultQuartzScheduler_Worker-10 [org.quartz.simpl.SimpleThreadPool]
  200. WorkerThread is shut down.
  201.  
  202. [DEBUG] 02 二月 01:50:31.029 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.simpl.SimpleThreadPool]
  203. WorkerThread is shut down.
  204.  
  205. [DEBUG] 02 二月 01:50:31.093 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.simpl.SimpleThreadPool]
  206. WorkerThread is shut down.
  207.  
  208. [DEBUG] 02 二月 01:50:31.093 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.simpl.SimpleThreadPool]
  209. WorkerThread is shut down.
  210.  
  211. [DEBUG] 02 二月 01:50:31.179 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.simpl.SimpleThreadPool]
  212. WorkerThread is shut down.
  213.  
  214. [DEBUG] 02 二月 01:50:31.179 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.simpl.SimpleThreadPool]
  215. WorkerThread is shut down.
  216.  
  217. [DEBUG] 02 二月 01:50:31.240 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.simpl.SimpleThreadPool]
  218. WorkerThread is shut down.
  219.  
  220. [DEBUG] 02 二月 01:50:31.258 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.simpl.SimpleThreadPool]
  221. WorkerThread is shut down.
  222.  
  223. [DEBUG] 02 二月 01:50:31.295 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.simpl.SimpleThreadPool]
  224. WorkerThread is shut down.
  225.  
  226. [DEBUG] 02 二月 01:50:31.339 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.simpl.SimpleThreadPool]
  227. WorkerThread is shut down.

 

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
  3.  
  4. <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  5.  
  6. <appender name="default" class="org.apache.log4j.ConsoleAppender">
  7. <param name="target" value="System.out"/>
  8. <layout class="org.apache.log4j.PatternLayout">
  9. <param name="ConversionPattern" value="[%p] %d{dd MMM hh:mm:ss.SSS aa} %t [%c]%n%m%n%n"/>
  10. </layout>
  11. </appender>
  12.  
  13. <logger name="org.quartz">
  14. <level value="debug" />
  15. </logger>
  16.  
  17. <root>
  18. <level value="debug" />
  19. <appender-ref ref="default" />
  20. </root>
  21.  
  22. </log4j:configuration>

  

 

Quartz1.8.5例子(四)的更多相关文章

  1. Quartz1.8.5例子(十四)

    org.quartz.scheduler.instanceName: PriorityExampleScheduler # Set thread count to 1 to force Trigger ...

  2. scrapy-splash抓取动态数据例子四

    一.介绍 本例子用scrapy-splash抓取微众圈网站给定关键字抓取咨询信息. 给定关键字:打通:融合:电视 抓取信息内如下: 1.资讯标题 2.资讯链接 3.资讯时间 4.资讯来源 二.网站信息 ...

  3. Quartz1.8.5例子(二)

    /* * Copyright 2005 - 2009 Terracotta, Inc. * * Licensed under the Apache License, Version 2.0 (the ...

  4. 从零开始学习Node.js例子四 多页面实现数学运算 续二(client端和server端)

    1.server端 支持数学运算的服务器,服务器的返回结果用json对象表示. math-server.js //通过监听3000端口使其作为Math Wizard的后台程序 var math = r ...

  5. 从零开始学习Node.js例子四 多页面实现数学运算 续一(使用connect和express框架)

    1.使用connect框架 .use方法用于绑定中间件到connect服务器,它会配置一系列在接到请求时调用的中间件模块,此例中我们要配置的中间件有favicon logger static rout ...

  6. 从零开始学习Node.js例子四 多页面实现数学运算

    app-node.js ; var http = require('http'); var htutil = require('./htutil'); var server = http.create ...

  7. Quartz1.8.5例子(十一)

    /* * Copyright 2005 - 2009 Terracotta, Inc. * * Licensed under the Apache License, Version 2.0 (the ...

  8. Quartz1.8.5例子(十)

    /* * Copyright 2005 - 2009 Terracotta, Inc. * * Licensed under the Apache License, Version 2.0 (the ...

  9. Quartz1.8.5例子(九)

    /* * Copyright 2005 - 2009 Terracotta, Inc. * * Licensed under the Apache License, Version 2.0 (the ...

随机推荐

  1. mysql 加载文本数据

    可以配置导入哪几列,每个字段用什么隔开,每行用什么隔开,也可以单独设置某个字段的值. 详细看代码: LOAD DATA INFILE 'D:/aa.txt' INTO TABLE aa FIELDS ...

  2. C语言 小游戏之贪吃蛇

    还记得非常久曾经听群里人说做贪吃蛇什么的,那时候大一刚学了C语言,认为非常难,根本没什么思路. 前不久群里有些人又在谈论C语言贪吃蛇的事了,看着他们在做,我也打算做一个出来. 如今大三,经过了这一年半 ...

  3. [Webpack 2] Validate your Webpack config with webpack-validator

    It’s quite common to make a mistake while developing your webpack configuration. A simple typo can c ...

  4. [TypeScript] Configuring a New TypeScript Project

    This lesson walks you through creating your first .tsconfig configuration file which will tell the T ...

  5. Java中NaN和-0.0f的比较问题

    简单的说,比较两个int型或long型的数据没有什么问题,可以用==来判断,但对浮点数(float与double)来说,需要对Float.NaN和0.0这个两个特殊数字作额外的处理.Float.NaN ...

  6. vlist java实现-转

    转自:http://www.blogjava.net/changedi/archive/2012/04/15/374226.html vlist是一种列表的实现.结构如下图: (图来源wikipedi ...

  7. 理解FTP协议

    为了防止无良网站的爬虫抓取文章,特此标识,转载请注明文章出处.LaplaceDemon/ShiJiaqi. http://www.cnblogs.com/shijiaqi1066/p/5186117. ...

  8. C# QRCode、DataMatrix和其他条形码的生成和解码软件

    今天制造了一个C#的软件,具体是用于生成二维码和条形码的,包括常用的QRCode.DataMatrix.Code128.EAN-8等等. 使用的第三方类库是Zxing.net和DataMatrix.n ...

  9. MyTask4

    最近稍微做了点修改,把几处bug修复了下,另外新增了授权码功能和数据缓冲功能 先看看效果图 1. 如果要把软件做的高大上一些,你可以加一个授权验证,授权码以字符串形式存放在程序里面,当然你也可以另外开 ...

  10. html语言中的meta元素

    1.定义语言  格式:〈meta http-equiv=″Content-Type″ content=″text/html; charset=gb2312″〉  这是META最常见的用法,在制作网页时 ...