quartz-scheduler

how to stop/interrupt quartz scheduler job manually

为君一笑 提交于 2019-12-04 19:24:33
I am running a simple quartz job in main class which runs every 30 secs. public class Start { public static void main(String[] args) throws Exception { SchedulerFactory sf = new StdSchedulerFactory(); Scheduler sched = sf.getScheduler(); JobDetail job = newJob(MyJob.class).withIdentity("myJob","XXX").build(); Trigger trigger = TriggerBuilder.newTrigger() .withSchedule( SimpleScheduleBuilder.simpleSchedule() .withIntervalInSeconds(30) .repeatForever()) .build(); sched.scheduleJob(job, trigger); sched.start(); } } Here i am implementing InterruptableJob like public class MyJob implements

How to create quartz job that will runs every N seconds even if job takes more time

戏子无情 提交于 2019-12-04 18:06:54
What I'm trying to achieve: I have a secondly trigger that fires every 5 secods, and stateful job, that takes sometimes more than 5 seconds (7 for example) and what I have now start: 00:00:00 end : 00:00:07 start: 00:00:07 < right after previous has finished what I want : start: 00:00:00 it should run at 00:00:05 but it hasn't end : 00:00:07 start: 00:00:10 (5 seconds after previous, successive or not) I have tried quartz.net version 2 and 1. Job: [PersistJobDataAfterExecution] [DisallowConcurrentExecution] public class StatefulJob : IJob (or IStatefulJob in 1.x version) { public void Execute

Best method of triggering a shell script from Java

隐身守侯 提交于 2019-12-04 16:59:32
I have a shell script which I'd like to trigger from a J2EE web app. The script does lots of things - processing, FTPing, etc - it's a legacy thing. It takes a long time to run. I'm wondering what is the best approach to this. I want a user to be able to click on a link, trigger the script, and display a message to the user saying that the script has started. I'd like the HTTP request/response cycle to be instantaneous, irrespective of the fact that my script takes a long time to run. I can think of three options: Spawn a new thread during the processing of the user's click. However, I don't

ASP.NET MVC: How to create a usable UrlHelper instance?

瘦欲@ 提交于 2019-12-04 16:33:21
问题 I am using quartz.net to schedule regular events within asp.net mvc application. The scheduled job should call a service layer script that requires a UrlHelper instance (for creating Urls based on correct routes ( via urlHelper.Action(..) ) contained in emails that will be sent by the service). I do not want to hardcode the links into the emails - they should be resolved using the urlhelper. The job: public class EvaluateRequestsJob : Quartz.IJob { public void Execute(JobExecutionContext

Quartz scheduler and OSGI

百般思念 提交于 2019-12-04 15:52:41
I have an OSGI scheduler bundle that has the Quartz Scheduler Jar in it. This bundle exposes just an application interface to other bundles and, when a new job is registered, it is wrapped into a temporaryJob (that implements StatefulJob) and scheduled using the scheduler. In this way I don't have to expose Quartz Scheduler jar (that it is not so much osgi compliant). The problem with this approach is that, since StatefulJob avoids to execute job in parallel and I have only one actual job (the temporaryJob), all my real jobs run one at a time. Unfortunately it seems that the marker interface

Dynamic Job Data using Quartz

戏子无情 提交于 2019-12-04 14:26:52
When my process gets a message, it needs to start a timer and execute some logic in X seconds. These jobs need to be stored in a JDBC store, which as far as I can tell may be irrelevant to this question. Based on what I've read, I should be able to assign a JobDataMap with different values for similar properties to a single Job class, but I'm unable to find any documentation or examples to back this use-case. Perhaps my Google-fu is weak. Does that make sense? Have one Job class and somehow store a JobDataMap to populate that Job class and run it on a per-message basis? Uriah Carpenter org

Quartz recovering from multiple days misfire

为君一笑 提交于 2019-12-04 11:04:31
I'm trying to set up Quartz for the first time, and forgive me if I am just not understanding something. I'm wondering what is the best way to accomplish the following: How to set up a job that must run a daily email report, and also be able to recover from a missed trigger so that: 1) the job knows what day the trigger was SUPPOSED to fire on. and 2) if (god forbid) the server is down for 3 days, Quartz will recover by running three missed days consecutively, also informing the job of what day each job represents. (execution order is not really important as long as I know what day each

stop quartz debug logging log4j

大兔子大兔子 提交于 2019-12-04 11:04:27
i'm stuck trying to turn off the annoying DEBUG logging of quartz. i'm using log4j as logging framework and i've already tried to add this line to the lg4j proprieties file "log4j.logger.org.quartz=ERROR" i'm still getting tons of these debugging logging messages 13:35:44.680 [MyScheduler_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers how can i turn this function off ? EDIT. i've moved my configuration to xml file...but still getting the same annoying problem <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j

Quartz vs. ScheduledExecutorService in Java web application

ε祈祈猫儿з 提交于 2019-12-04 10:29:11
问题 For a system monitoring Java application which currently runs on the command line and uses ScheduledExecutorService, I would like to write a simple web application version, to be run in a Servlet container like Apache Tomcat or Eclipse Jetty. I have read about Quartz as one of the popular job schedulers for web applications. Would it be better (maybe because of better servlet container integration) to port this application from ScheduledExecutorService to Quartz? Adding another library

Grails: Tomcat won't shut down cleanly in prod

帅比萌擦擦* 提交于 2019-12-04 10:13:54
I have an issue with shutting down a Grails app in production. It shuts down cleanly when running from IntelliJ. But on a standalone Tomcat 7, shutting down gets it into a zombie state where the java process still exists but HTTP requests hang. I have to kill the java process (using kill). I'm using Tomcat's standard bin/startup.sh and shutdown.sh. With Tomcat stopped, I drop the .war into Tomcat's /webapps directory and then start. I suspect it could be the Quartz job scheduler plugin, but I deployed a version with no jobs in grails-app/jobs and it still hangs. Anybody run across this before?