You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ep...@apache.org on 2003/04/18 15:05:28 UTC
cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/services/schedule TurbineSchedulerService.java
epugh 2003/04/18 06:05:28
Modified: src/java/org/apache/turbine/services/schedule
TurbineSchedulerService.java
Log:
Changed scheduler service to not connect to the database if the enabled
property is set to false. Otherwise, you always get a Torque no datasource
error everytime! Even if you aren't using the scheduler!
Revision Changes Path
1.13 +26 -33 jakarta-turbine-2/src/java/org/apache/turbine/services/schedule/TurbineSchedulerService.java
Index: TurbineSchedulerService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/schedule/TurbineSchedulerService.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TurbineSchedulerService.java 7 Apr 2003 15:48:58 -0000 1.12
+++ TurbineSchedulerService.java 18 Apr 2003 13:05:27 -0000 1.13
@@ -76,9 +76,7 @@
* @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
* @version $Id$
*/
-public class TurbineSchedulerService
- extends TurbineBaseService
- implements ScheduleService
+public class TurbineSchedulerService extends TurbineBaseService implements ScheduleService
{
/** Logging */
private static Log log = LogFactory.getLog(ScheduleService.LOGGER_NAME);
@@ -110,28 +108,31 @@
* @throws InitializationException Something went wrong in the init
* stage
*/
- public void init()
- throws InitializationException
+ public void init() throws InitializationException
{
try
{
+ setEnabled(getConfiguration().getBoolean("enabled", true));
scheduleQueue = new JobQueue();
mainLoop = new MainLoop();
- // Load all from cold storage.
- List jobs = JobEntryPeer.doSelect(new Criteria());
-
- if (jobs != null && jobs.size() > 0)
+ if (isEnabled())
{
- Iterator it = jobs.iterator();
- while (it.hasNext())
+
+ // Load all from cold storage.
+ List jobs = JobEntryPeer.doSelect(new Criteria());
+
+ if (jobs != null && jobs.size() > 0)
{
- ((JobEntry) it.next()).calcRunTime();
- }
- scheduleQueue.batchLoad(jobs);
+ Iterator it = jobs.iterator();
+ while (it.hasNext())
+ {
+ ((JobEntry) it.next()).calcRunTime();
+ }
+ scheduleQueue.batchLoad(jobs);
- setEnabled(getConfiguration().getBoolean("enabled", true));
- restart();
+ restart();
+ }
}
setInit(true);
@@ -154,8 +155,7 @@
* @param config A ServletConfig.
* @deprecated use init() instead.
*/
- public void init(ServletConfig config)
- throws InitializationException
+ public void init(ServletConfig config) throws InitializationException
{
init();
}
@@ -180,8 +180,7 @@
* @return A JobEntry.
* @exception TurbineException job could not be retreived.
*/
- public JobEntry getJob(int oid)
- throws TurbineException
+ public JobEntry getJob(int oid) throws TurbineException
{
try
{
@@ -202,8 +201,7 @@
* @param je A JobEntry with the job to add.
* @throws TurbineException job could not be added
*/
- public void addJob(JobEntry je)
- throws TurbineException
+ public void addJob(JobEntry je) throws TurbineException
{
updateJob(je);
}
@@ -214,8 +212,7 @@
* @param je A JobEntry with the job to remove.
* @exception TurbineException job could not be removed
*/
- public void removeJob(JobEntry je)
- throws TurbineException
+ public void removeJob(JobEntry je) throws TurbineException
{
try
{
@@ -243,8 +240,7 @@
* @param je A JobEntry with the job to modify
* @throws TurbineException job could not be updated
*/
- public void updateJob(JobEntry je)
- throws TurbineException
+ public void updateJob(JobEntry je) throws TurbineException
{
try
{
@@ -384,8 +380,7 @@
* @return A JobEntry.
* @exception TurbineException a generic exception.
*/
- private synchronized JobEntry nextJob()
- throws TurbineException
+ private synchronized JobEntry nextJob() throws TurbineException
{
try
{
@@ -420,8 +415,7 @@
}
}
catch (InterruptedException ex)
- {
- }
+ {}
// On interrupt.
return null;
@@ -432,8 +426,7 @@
* so that the main class need not implement Runnable, which would
* allow others to directly invoke run, which is not supported.
*/
- protected class MainLoop
- implements Runnable
+ protected class MainLoop implements Runnable
{
/**
* Method to run the class.
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org