[Building Sakai] need to delay startup of quartz

Charles Hedrick hedrick at rutgers.edu
Thu Jan 22 11:57:02 PST 2015


--- a/sam/samigo-services/src/java/org/sakaiproject/tool/assessment/services/AutoSubmitAssessmentsJob.java
+++ b/sam/samigo-services/src/java/org/sakaiproject/tool/assessment/services/AutoSubmitAssessmentsJob.java
@@ -45,6 +45,13 @@ public class AutoSubmitAssessmentsJob implements StatefulJob {
         * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
         */
        public void execute(JobExecutionContext jobInfo) throws JobExecutionException {
+
+               // make sure Samigo is set up
+               if (org.sakaiproject.tool.assessment.integration.context.IntegrationContextFactory.getInstance() == null) {
+                   LOG.warn("Did not start job; Samigo not set up");
+                   return;
+               }
+
                loginToSakai("admin");
  
                String jobName = jobInfo.getJobDetail().getName(); 



> On Jan 22, 2015, at 2:51 PM, Sam Ottenhoff <ottenhoff at longsight.com> wrote:
> 
> This sounds like a good approach to me Chuck.  Feel free to submit a PR of if you point me to your change, I'm willing to turn it into a PR.
> 
> --Sam
> 
> On Wed, Jan 21, 2015 at 11:30 AM, Charles Hedrick <hedrick at rutgers.edu <mailto:hedrick at rutgers.edu>> wrote:
> The other option is to make the samigo job exit without doing anything if the UI isn’t up. That avoids having to modify Quatz, at the cost of delaying auto submit processes by a cycle (by default 30 min) in the fairly rare cases where this happens. That’s what we’re doing in production. I can give you the code if you’d prefer that approach.
> 
> > On Jan 21, 2015, at 11:22 AM, Matthew Buckett <matthew.buckett at it.ox.ac.uk <mailto:matthew.buckett at it.ox.ac.uk>> wrote:
> >
> > We could make SpringBeanLocator block until it has had a had a context
> > inject set on it, in a similar way to the
> > ComponentManager.getInstance() doesn't return until the component
> > manager has started up.
> >
> > This does run the risk of a deadlock occurring if the main Tomcat
> > startup thread ends up calling SpringBeanLocator.
> >
> > A quick hack of this is at:
> >
> > https://github.com/buckett/sakai/commit/4d9f0a1b7b2fb62398457f2e2f006dd2390bb7ba <https://github.com/buckett/sakai/commit/4d9f0a1b7b2fb62398457f2e2f006dd2390bb7ba>
> >
> > what do you think?
> >
> > Adjusting the job scheduler because of a bad practice in the tool
> > doesn't set a good precedent for how these sorts of problems get
> > solved in the future.
> >
> > --
> >  Matthew Buckett, VLE Developer, IT Services, University of Oxford
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20150122/198cacd3/attachment.html 


More information about the sakai-dev mailing list