Job Scheduling with Quartz and Timer

Discussions

News: Job Scheduling with Quartz and Timer

  1. Job Scheduling with Quartz and Timer (39 messages)

    Dejan Bosanac has written an article on job scheduling in Java. He starts with a home grown java.util.Timer solution, and then moves to the more powerful Quartz library. Quartz is used for scheduling in projects such as javablogs.com.

    Summary

    "We've looked at two ways to do scheduling in Java. Quartz is indeed a powerful library, but for simple requirements the Timer API can save the day, keeping you from putting unnecessary complexity into the system. You should think of using the Timer API in cases where you don't have a lot of tasks that need to be scheduled, and when their execution times are well-known (and unchangeable) in the design process. In these situations, you don't have to worry whether some tasks are lost because of a shutdown or crash. For more sophisticated needs, Quartz is an elegant scheduling solution. Of course, you can always make your own framework, based on the Timer, but why to bother when all that (and much more) already exist?

    One event worth nothing is IBM and BEA's submission of JSR 236 titled "Timer for Application Servers". This specification is focused on creating an API for timers in managed environments where using the standard API is insufficient. You can find more details about the specification on IBM's developerWorks site, and the specification should be available for public review in spring."


    Read Job Scheduling in Java

    Threaded Messages (39)

  2. Cron Scheduling[ Go to top ]

    It pretty much implements Cron scheduling completely, which is a big win for timer flexibility. probably not what you are looking for in an app server, but definitely worth looking at for non-j2ee apps.
  3. Is the any way we can cancel the scheduled job ?
  4. If you're asking about Quartz, the answer is yes.

    Simply: scheduler.unschedulerJob(..)
  5. I have a cron job , 0 * 7-10 * * ?
    If during the hours of 7-10, the result of its execution (executionContext.getResult("ok")) is "ok", I want the job to stop and then resume the next day, not the next cron time which would be the next minute as long as 10 AM has not been reached.

    I set up a secon job on a second cron to control the one above better.
    But i can not initialize the JobSevlet : error:org.quartz.ObjectAlreadyExistsException: Unable to store Job with name: 'SRInitJob' and group: 'DEFAULT', because one already exists with this identification.
            at org.quartz.simpl.RAMJobStore.storeJob(RAMJobStore.java:220)
            at org.quartz.simpl.RAMJobStore.storeJobAndTrigger(RAMJobStore.java:193)
  6. When I use DB persistence, I get the following exception when I restart the app server. I have set overWriteExistingJobs property to true but didnt help
    Thanks for any help

    INFO: Registering Quartz Job Initiazation Plug-in.
    Dec 3, 2004 9:38:28 AM org.quartz.impl.jdbcjobstore.JobStoreSupport storeJob
    INFO: note: volatile jobs are effectively non-volatile in a clustered environment.
    <Dec 3, 2004 9:38:28 AM CST> <Info> <HTTP> <BEA-101047> <[ServletContext(id=22844803,name=/hiddenscheduling,context-path
    =/hiddenscheduling)] SchedulingInit: Quartz Scheduler failed to initialize: org.quartz.ObjectAlreadyExistsException: Una
    ble to store Job with name: 'JobInitializationPlugin_jobinit' and group: 'JobInitializationPlugin', because one already
    exists with this identification.>
    org.quartz.ObjectAlreadyExistsException: Unable to store Job with name: 'JobInitializationPlugin_jobinit' and group: 'Jo
    bInitializationPlugin', because one already exists with this identification.
            at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJob(JobStoreSupport.java:811)
            at org.quartz.impl.jdbcjobstore.JobStoreCMT.storeJobAndTrigger(JobStoreCMT.java:276)
            at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:576)
            at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:221)
            at org.quartz.plugins.xml.JobInitializationPlugin.initialize(JobInitializationPlugin.java:270)
            at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:757)
            at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:904)
            at org.quartz.ee.servlet.QuartzInitializerServlet.init(QuartzInitializerServlet.java:125)
  7. just a hint[ Go to top ]

    You might have an xml file containing the same jobs as well when starting up? do you execute: processFileAndScheduleJobs or processFile ?
  8. ObjectAlreadyExistsException[ Go to top ]

    When my app serever restarts I get the error:org.quartz.ObjectAlreadyExistsException: Unable to store Job with name: 'MyJob' and group: 'DEFAULT', because one already exists with this identification.
            at org.quartz.simpl.RAMJobStore.storeJob(RAMJobStore.java:220)
    How is the Scheduler keeping data even after I shutdown my aoo server? I do not have either a properties or a config file. I never call processFileAndScheduleJobs or processFile.
  9. Have you set the param shutdown-on-unload to true on your web.xml configuration file? try this: shutdown-on-unload true
  10. Am using DB persistence ang getting this error "ObjectAlreadyExistsException" when i restart the server and quartz wont continue firing jobs(cant see anything outputted to console). How can i overwrite jobs kept in the database using the properties file. Is there any other way of getting around this error. Plizz assist... 2/7/07 12:40:11:483 CAT] 00000038 QuartzSchedul I Quartz Scheduler v.UNKNOWN.UNKNOWN.UNKNOWN created. [2/7/07 12:40:11:530 CAT] 00000038 JobInitializa I Registering Quartz Job Initialization Plug-in. [2/7/07 12:40:11:561 CAT] 00000038 JobInitializa W File named 'quartz_jobs.xml' does not exist. [2/7/07 12:40:11:608 CAT] 00000038 ShutdownHookP I Registering Quartz shutdown hook. [2/7/07 12:40:11:655 CAT] 00000038 JobStoreCMT I Using db table-based data access locking (synchronization). [2/7/07 12:40:15:889 CAT] 00000038 JobStoreCMT I Removed 0 Volatile Trigger(s). [2/7/07 12:40:15:952 CAT] 00000038 JobStoreCMT I Removed 0 Volatile Job(s). [2/7/07 12:40:15:983 CAT] 00000038 JobStoreCMT I JobStoreCMT initialized. [2/7/07 12:40:15:999 CAT] 00000038 StdSchedulerF I Quartz scheduler '_Bean_Biz_Reports_Scheduler_' initialized from the specified file : 'C:/quartz/quartz.properties' [2/7/07 12:40:16:077 CAT] 00000038 StdSchedulerF I Quartz scheduler version: UNKNOWN.UNKNOWN.UNKNOWN [2/7/07 12:40:16:124 CAT] 00000038 SystemOut O ===Running added code [2/7/07 12:40:16:952 CAT] 00000038 WebApp A SRVE0180I: [PersitentQuartzWeb] [/PersitentQuartzWeb] [Servlet.LOG]: QuartzInitializerServlet: Quartz Scheduler failed to initialize: org.quartz.ObjectAlreadyExistsException: Unable to store Job with name: 'Foster's Reports' and group: 'New Business', because one already exists with this identification. [2/7/07 12:40:17:296 CAT] 00000038 ServletWrappe E Uncaught init() exception thrown by servlet QuartzInitializerServlet [2/7/07 12:40:17:327 CAT] 00000038 WebExtensionP E Error occured while preparing theservlet for initialization. Check the error logs for details. [2/7/07 12:40:17:343 CAT] 00000038 WebExtensionP E SRVE0026E: [Servlet Error]-[javax.servlet.ServletException: Unable to store Job with name: 'Foster's Reports' and group: 'New Business', because one already exists with this identification. at zw.co.quartzsample.QuartzInitializerServlet.init(QuartzInitializerServlet.java:131) at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:262) at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1319) at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:84) at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:745) at com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.java:493) at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:379) at com.ibm.ws.webcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:114) at com.ibm.ws.webcontainer.VirtualHost.addWebApplication(VirtualHost.java:127) at com.ibm.ws.webcontainer.WebContainer.addWebApp(WebContainer.java:776) at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:729) at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:140) at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:360) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1019) at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1028) at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:538) at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:724) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:683) at com.ibm.ws.runtime.component.ApplicationMgrImpl$AppInitializer.run(ApplicationMgrImpl.java:1678) at com.ibm.ws.runtime.component.ComponentImpl$_AsynchInitializer.run(ComponentImpl.java:304) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
  11. Am using DB persistence ang getting this error "ObjectAlreadyExistsException" when i restart the server and quartz wont continue firing jobs(cant see anything outputted to console). How can i overwrite jobs kept in the database using the properties file. Is there any other way of getting around this error. Plizz assist... 2/7/07 12:40:11:483 CAT] 00000038 QuartzSchedul I Quartz Scheduler v.UNKNOWN.UNKNOWN.UNKNOWN created. [2/7/07 12:40:11:530 CAT] 00000038 JobInitializa I Registering Quartz Job Initialization Plug-in. [2/7/07 12:40:11:561 CAT] 00000038 JobInitializa W File named 'quartz_jobs.xml' does not exist. [2/7/07 12:40:11:608 CAT] 00000038 ShutdownHookP I Registering Quartz shutdown hook. [2/7/07 12:40:11:655 CAT] 00000038 JobStoreCMT I Using db table-based data access locking (synchronization). [2/7/07 12:40:15:889 CAT] 00000038 JobStoreCMT I Removed 0 Volatile Trigger(s). [2/7/07 12:40:15:952 CAT] 00000038 JobStoreCMT I Removed 0 Volatile Job(s). [2/7/07 12:40:15:983 CAT] 00000038 JobStoreCMT I JobStoreCMT initialized. [2/7/07 12:40:15:999 CAT] 00000038 StdSchedulerF I Quartz scheduler '_Bean_Biz_Reports_Scheduler_' initialized from the specified file : 'C:/quartz/quartz.properties' [2/7/07 12:40:16:077 CAT] 00000038 StdSchedulerF I Quartz scheduler version: UNKNOWN.UNKNOWN.UNKNOWN [2/7/07 12:40:16:124 CAT] 00000038 SystemOut O ===Running added code [2/7/07 12:40:16:952 CAT] 00000038 WebApp A SRVE0180I: [PersitentQuartzWeb] [/PersitentQuartzWeb] [Servlet.LOG]: QuartzInitializerServlet: Quartz Scheduler failed to initialize: org.quartz.ObjectAlreadyExistsException: Unable to store Job with name: 'Foster's Reports' and group: 'New Business', because one already exists with this identification. [2/7/07 12:40:17:296 CAT] 00000038 ServletWrappe E Uncaught init() exception thrown by servlet QuartzInitializerServlet [2/7/07 12:40:17:327 CAT] 00000038 WebExtensionP E Error occured while preparing theservlet for initialization. Check the error logs for details. [2/7/07 12:40:17:343 CAT] 00000038 WebExtensionP E SRVE0026E: [Servlet Error]-[javax.servlet.ServletException: Unable to store Job with name: 'Foster's Reports' and group: 'New Business', because one already exists with this identification. at zw.co.quartzsample.QuartzInitializerServlet.init(QuartzInitializerServlet.java:131) at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:262) at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1319) at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:84) at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:745) at com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.java:493) at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:379) at com.ibm.ws.webcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:114) at com.ibm.ws.webcontainer.VirtualHost.addWebApplication(VirtualHost.java:127) at com.ibm.ws.webcontainer.WebContainer.addWebApp(WebContainer.java:776) at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:729) at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:140) at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:360) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1019) at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1028) at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:538) at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:724) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:683) at com.ibm.ws.runtime.component.ApplicationMgrImpl$AppInitializer.run(ApplicationMgrImpl.java:1678) at com.ibm.ws.runtime.component.ComponentImpl$_AsynchInitializer.run(ComponentImpl.java:304) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
  12. Hello,

    I am getting the same exception of unable to store the job ,one identifier already exists .

    I found out a work around for some time ,I used to restart my jboss serevr and the things worked fine for me but now i want the quartz thread to be killed .

     

    I wrote a servlet where i scheduled my quartz schedular and wrote load on start up as 0 in my web.xml

    where as to shutdown it i wrote shutown on  unload and wrote schedular . shutdown in my destro m() of the servlet.But i am blocked at the same point here also.

    Regards

    Anshu

  13. Cron Scheduling[ Go to top ]

    Actually, most people using Quartz are using it within an App. Server.

    It's very usefull for driving order processing, workflows in general, running maintenance tasks, end of month reports, etc.
  14. It might apply to only Application server arena but any JMX compliant server has to implement Timer service and this service also gives developers enough depth for any timer service can provide.

    mustafa
  15. Nope,
    JMX is not really integrated at all with the J2EE spec. For example, when your MBean is called, whats your enviroment? java:comp? How do you look up EJBs, DataSources, env-entries etc. Who are you logged in as if security is on?

    There is a lot of work here for the JCP in order to really do this property and AFAIK, there is no current JSR to do this.

    JSR237 will define mechanisms which can help with this but integrating JMX and J2EE is not our focus.

    Billy
    (IBM)
  16. How to acheive something like this.

    I will run the program only once then it should spawn a job which is something like Winnt service & keep on running later.
    Then i wil close my parent program which initiated the job. But this in no way should affect the job which was started on running the parent program.
    The job spawned by the parent program should keep on running. Can we acheive something like this with Quartz
  17. Quartz Complex?[ Go to top ]

    drop in the jar, make a MyJobImpl ,implement the execute(), and add a trigger, your done.

    jeryl
  18. This article is exactly what I was looking for. Because I need a timer service that should run in and out of an EJB-container. Thanks guys for making and spotting it for me :-).

    Maybe a little off topic but I'll ask anyway : "Does anybody know the difference between the JSR 236 titled "Timer for Application Servers" mentioned and the TimerService defined in EJB 2.1. The JSR236 didn't even mentioned it in the question "Why isn't this need met by existing specifications?"

    Regards,
    Tom Baeyens
    Founder of Java Business Process Management -the open source workflow engine-
    Expertgroupmember of JSR207 "Process Definition for Java"
  19. JSR236[ Go to top ]

    JSR236 is to define a set of interfaces and a J2EE binding/discovery mechanism to allow J2EE applications to be able to use lightweight non persistent Timers safely within their applications. EJB 2.1 defines persistent transaction events which require the use of an EJB as the target. 236 also allows POJOs to be used as the target. An example of this today in the AlarmManager API set from the async beans feature set in WAS 5.x Enterprise which provides this facility for WebSphere customers.

    It would be great if we can use these interfaces for all such timer services in the platform.

    Billy
    (IBM)
  20. Testing and Time[ Go to top ]

    Some talk about problems with scheduled jobs and testing them.

    We have jobs in the system similar to those mentioned in the article, reports, maintenance, etc, some bisness logic also. Some business events happen only monthly.

    Our testers have great pains testing features that deal with time. Because to emulate user's activity you have to run a test for more than a month.

    What I've been thinking for quite a time already is to have some "time machine" that could be used to zip through this month within a reasonable amount of time. That would imply using something like Quartz for scheduling, as well as changing all System.currentTimeMillis() calls to something controllable.

    Unfortunately Quartz doesn't seem to offer such thing. Anyone familiar with what I've described?

    Regards,
    Igor
  21. Testing and Time[ Go to top ]

    Quartz "nearly" supported this, through the usage of an interface that it had named "TimeBroker".

    However, it was never put into a release, because it's actually much tougher than it sounds, and furthermore it leads to most users who try to use it complaining that there are bugs in Quartz that are actually bugs in their code - but they don't understand all of the issues involved once you start "speeding up" certain events in the system, while the rest of the system (i.e. the stuff in your app that is not ran by Quartz) is still running at "real speed".

    One simple solution is to advance the clock on your system while Quartz is running. ... simple in concept anyway ;-)
  22. Time compressing is tough[ Go to top ]

    Yes, time compressing is tough - that's why I was looking for a framework or solution, or at least for a single success story, before starting doing something like that myself... For heterogenous it's even tougher - we have Oracle queries and procedures that use SYSDATE function freely.

    Btw, advancing system clock is not a solution :). Even not mentioning problems with other programs and OS on the system - Thread.sleep() shouldn't wake up just because you changed system time. (my guess)

    Which gave me the idea: I just skipped through JDK sources, and there's quite a few places where they use System.currentTimeMillis() themselves. Most are quite innocuous, but some may cause trouble if we want to bend time.

    Say, could we change native method implementation? Give some DLL or SO library to the java so we'll have our own currentTimeMillis(), sleep() and other methods?
  23. -----------
    What I've been thinking for quite a time already is to have some "time machine" that could be used to zip through this month within a reasonable amount of time. That would imply using something like Quartz for scheduling, as well as changing all System.currentTimeMillis() calls to something controllable.
    -----------

    I needed something like this for unit testing recently so that I could test things like timeouts deterministically. All I did was ensure that all references to real time (i.e. timeinmillis) went throught a singleton that had a "fake time" facility allowing the time it would return to be set explicitly by the tests. i dont know of any library that specifically helps with this though.

    Paul C.
  24. Replace java.lang.System class with your implementation,
    you can do it for testing.

    -----------
    What I've been thinking for quite a time already is to have some "time machine" that could be used to zip through this month within a reasonable amount of time. That would imply using something like Quartz for scheduling, as well as changing all System.currentTimeMillis() calls to something controllable.
    -----------

    I needed something like this for unit testing recently so that I could test things like timeouts deterministically. All I did was ensure that all references to real time (i.e. timeinmillis) went throught a singleton that had a "fake time" facility allowing the time it would return to be set explicitly by the tests. i dont know of any library that specifically helps with this though.

    Paul C.
  25. Replace java.lang.System class with your implementation,
    you can do it for testing.
    This is something I tried to do a while ago and I ran into the issue of currentTimeMillis being a native method and was not able to change it to a non native implementation. Could you explain how you achieved that?
  26. Replace java.lang.System class with your implementation,
    you can do it for testing.
    This is something I tried to do a while ago and I ran into the issue of currentTimeMillis being a native method and was not able to change it to a non native implementation. Could you explain how you achieved that?
    I have never tried to do it, but looks like I will need it for testing too
    (I use "date" command and this time)

    As I understand it must be no problems to change native method to a non native, doe's jvm throws linker error if you drop "native" modifier ?
  27. As I understand it must be no problems to change native method to a non native, doe's jvm throws linker error if you drop "native" modifier ?

    When switching to non native, I get

    Error occurred during initialization of VM
    java.lang.NoSuchMethodError: java.lang.System.currentTimeMillis()J

    My interpretation is that the System class calls registerNatives() which register the currentTimeMillis method. Since a method with that signature is registered, you cannot create a non native version of currentTimeMillis with the same signature.
  28. It fails with the same message for me too, probably we need to drop all native methods in System class.
  29. Pinned services (and Quartz)[ Go to top ]

    During research for a 'pinned service' solution I have been evaluating if Quartz could suit my needs.

    Original message posed in quartz forum:
    http://sourceforge.net/forum/forum.php?thread_id=1038351&forum_id=152914


    About pinned services:
    ======================
    It is a service that handles to execute a job as a singleton in a clustered environment. By singleton I mean the job is only running on one of the server instances in the cluster. The pinned service should support fail over. Fail over is need to started the job on another server if the job is not executing anymore (server crashed, server has been shutdown etc.). Starting the job on another server can be archived by a watch dog that monitors if the job is not executing anymore and thus starts it.

    The pinned service should be used for long lasting jobs that are supposed to run all the time.

    A Solution
    ==========
    An idea for a solution for pinned service is to use the database as a semaphore for accesing a lock (key). The semaphore must have a expiry time. If the current time > expiry time then the lock are free again and another can accuire the key. This is needed to be able to automatic have the job started on another server if the server crashed where the job was currently running. Using the expiry time requires the job by certain intervals to refresh the key. Unfortunately that bounds the client (the job having the key) to remember to do this.

    So to recap:
    ============
    pinned service requires a semaphore and bounds the client at certain intervals to refresh the key to prevent the same job to be started on another server (we only want the job to be running on one server at a given time). If a server crashes the job is started on another server when the expiry time on the lock has been reached.

    Why quartz can not do this:
    ===========================
    Quartz are great for starting batch jobs at certain user defined times. A job is started at any given time if the trigger is fired regardles if the existing job has been finished or not. Therefore a situation with two jobs running at the same time can happend. This is a situation we do not decire by pinned service.

    Quartz have 'stateful jobs'. By stateful jobs only one job are started => 'kind a' pinned service.

    Some issues for stateful jobs:
    ==============================
    a) How does Quartz check for a job not running if there is a server crash? If there is a crash how is the job restarted? Our job does not have any state we just want it to be a singleton job spanning the entire cluster.
    b) What about zombie jobs? To prevent zombies you could require the job not to last more than x hours.
    c) As I understand if a stateful job is triggered to start and another job is already running the new job waits until the first job ends => queue. Running for quite some time this queue could grow large.
    A pinned service could be archived if the 2nd job is not queued at all since the job is already running. The only extra requirement is to have a mechanism checking if the job is 'really' running (the job itself must at certain intervals flag this).

    Is it anyhow possible for Quartz to support pinned services? If so is it something that could be added to the framework in the future?

    Anyone else have a solution for this? An exisitng framework or did you code it yourself? And advice to share?
  30. Pinned services (and Quartz)[ Go to top ]

    I'm afraid the thread is long dead. But I was wondering Claus if you ever found a clustered scheduler that would allow for 'pinned service'?

    Mike
  31. Pinned services (and Quartz)[ Go to top ]

    Quartz has a clustered schedule function
    see
    http://quartz.sourceforge.net/javadoc/org/quartz/examples/ClusterTest.html
  32. JMX, Timers & Quartz[ Go to top ]

    hi all,
    in my app i had to implement Scheduler functionality...
    i choosed to use JMX Timer...however my implementation is very simple, while i guess with Quartz i can implement persistence and some 'complex' scheduling (for example, execute some task every 1st day of the month etc..).
    But what i don't like is to run another server on my machine, since i am already running the application server.
    Is there any way that i can use Quartz without starting Quartz's own server? can i wrap it (if it is worth) in a MBean?

    thanx for any clarification and regards
    Marco
  33. JMX, Timers & Quartz[ Go to top ]

    Yep, we also implemented our own scheduler using JMX Timer. If Quartz can be run as an MBean that would be great.
  34. JMX, Timers & Quartz[ Go to top ]

    Yes Quartz can be wrapped as an MBean.

    In fact, it ships with the capability, and the build file includes a target to create a JBoss .SAR file for the MBean.

    james
  35. Job Instanciation[ Go to top ]

    Is it possible (not found in the API) to use a Job previously created by application?

    I would like to fire/run a method on an object A, without creation proxy Job that call "run" on A, put as entry in JobDataMap.

    And is it possible to configure Scheduler without property file ?
  36. reuse Job Instanciation[ Go to top ]

    Is it possible (not found in the API) to use a Job previously created by application?
    I would like to fire/run a method on an object A, without creation proxy Job that call "run" on A, put as entry in JobDataMap.
    And is it possible to configure Scheduler without property file ?
    A Job instance can't be reuse, but you can take it as a Listener and create NoOpJob as Job if needed.
  37. See also: Flux.

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Clustered JCache for Grid Computing!
  38. TimerTask and class loaders[ Go to top ]

    Hi.
    I use a Timer to run a job every night. i have a problem getting a resource (class.getResouceAsStream) for any class in a specific framework that is in a jar in WEB-INF/lib.
    when i call the same code from struts (from a user request), everything works well.
    Does anyone know something about class loader problems when running a Timer?
  39. TimerTask and class loaders[ Go to top ]

    I use a Timer to run a job every night. i have a problem getting a resource (class.getResouceAsStream) for any class in a specific framework that is in a jar in WEB-INF/lib. when i call the same code from struts (from a user request), everything works well. Does anyone know something about class loader problems when running a Timer?

    Sure. It's probably because of the way you are loading the resource, and the code is running on the timer thread, so it doesn't have the thread context class loader for the app. Take your class (MyClass.class for example) and as it for its loader (MyClass.class.getClassLoader()) and ask *it* to load the resource.

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Clustered JCache for Grid Computing!
  40. This article explores about job[ Go to top ]

    This article explores about job scheduling in Java and also about the strong Quartz library. From the article, we learn that Quartz is used for scheduling in javablogs.com. For those searching for dedicated server hosting packages this article may interest you. If you want more details, you can research about job scheduling through the world wide web. There are many free web resources on the topic that you can access when you are online.

    Paul - http://www.connetu.com