tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hole" <andremailingl...@gmail.com>
Subject Re: Quartz
Date Thu, 06 Sep 2007 14:27:07 GMT
I found something interesting, maybe is what I need!
Spring and Quartz together is a good solution but I don't want another
component in my java web application.
What's your opinion?

1) It would be helpful to show an example of how to configure Quartz to work
without a custom servlet. It can be done and is probably the most likely way
people will use it within a J2EE application. I recently implemented
something like this, and had to figure it out for myself since the Quartz
docs weren't very explicit. Basically, you
-Configure your web app to use the Quartz initializer servlet, loading on
startup. For example (from web.xml):

<servlet>
<servlet-name>quartz</servlet-name>
<display-name>Quartz Initializer Servlet</display-name>
<servlet-class>org.quartz.ee.servlet.QuartzInitializerServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

-Add a "quartz.properties" file to your classpath, indicating how jobs will
be loaded (as well as the quartz system properties). For example (from
quartz.properties):

org.quartz.plugin.jobInitializer.class =
org.quartz.plugins.xml.JobInitializationPlugin
org.quartz.plugin.jobInitializer.fileName = quartz-jobs.xml
org.quartz.plugin.jobInitializer.overWriteExistingJobs = true
org.quartz.plugin.jobInitializer.failOnFileNotFound = true

-Add an xml file configuring your jobs and triggers, using the file name
specified under the "org.quartz.plugin.jobInitializer.fileName" property.
For example (from quartz-jobs.xml, in this case):

 <job>
    <job-detail>
      <name>alertJob</name>
      <group>alertJobs</group>
      <job-class>com.somecompany.AlertJob</job-class>
      <volatility>false</volatility>
      <durability>false</durability>
      <recover>false</recover>
    </job-detail>
    <trigger>
      <cron>
        <name>dailyTrigger</name>
        <group>alertTriggers</group>
        <job-name>alertJob</job-name>
        <job-group>alertJobs</job-group>
        <!-- every night at 2:15AM, M-F -->
        <cron-expression>0 15 2 ? * MON-FRI</cron-expression>
      </cron>
    </trigger>
  </job>

Again, I think this is the most flexible, easy to use way to implement
quartz, and I'm surprised it's not documented better. In most systems I use,
I don't want to hard-code something like a scheduled process that might be
subject to frequent scheduling change.

2) The author mentions the "userThreads" setting for application servers to
allow Quartz to use user threads. Unfortunately, I'm kind of thread-dumb, so
I don't exactly know what this means or why it's important. What happens if
Quartz is deployed without this setting? What implications does this setting
have to other aspects of server performance (will it cause a conflict with
some other setting)? I actually am in the middle of deploying an app that
uses Quartz on OC4J and would like to be aware of the implications and
necessity of this setting.


On 9/6/07, Pid <p@pidster.com> wrote:
>
> Andrew Hole wrote:
> > I can't find an example of using Quartz to scheduling jobs on Tomcat Web
> > application.
> > Someone already work with Quartz? Could you share a hello world sample?
> >
> > Thanks a lot
> >
>
> http://www.opensymphony.com/quartz/wikidocs/Tutorial.html
>
> http://www.opensymphony.com/quartz/wikidocs/QuickStart.html
>
>
> http://forums.opensymphony.com/search.jspa?threadID=&q=tomcat&objID=f6&dateRange=last90days&userID=&numResults=15&rankBy=10001
>
>
> Google is your friend.
>
>
> p
>
>


On 9/6/07, Pid <p@pidster.com> wrote:
>
> Andrew Hole wrote:
> > I can't find an example of using Quartz to scheduling jobs on Tomcat Web
> > application.
> > Someone already work with Quartz? Could you share a hello world sample?
> >
> > Thanks a lot
> >
>
> http://www.opensymphony.com/quartz/wikidocs/Tutorial.html
>
> http://www.opensymphony.com/quartz/wikidocs/QuickStart.html
>
>
> http://forums.opensymphony.com/search.jspa?threadID=&q=tomcat&objID=f6&dateRange=last90days&userID=&numResults=15&rankBy=10001
>
>
> Google is your friend.
>
>
> p
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message