Quartz and the update checker

Updated

Every programmer has probably at some point used a timer to run a piece of code at some exact time or after some exact interval. If you’ve used java, you’ve probably heard about Quartz scheduler.

I’ve used Quartz in couple of my own projects, but I haven’t followed the project recently. Today I decided to rewrite some of my old code and update Quartz to the latest version. Ealier I’ve used Quartz version 1.6.1 and today when I checked the current stable version is 2.0.2.

I update the quartz jar and refactored the old scheduler code. All in all, everything went quite easily, although at one point I had to look at the example source code to figure out how the new builders are used. Eventually the code compiled and the jobs fired as they should.

One really surprising thing is that TerraCotta has added and update checker feature to the library and it’s turned on by default. The update checker contacts the TerraCotta servers and asks for the newest version of Quartz. If you’re running an older version, the checker prints a message to the log. It’s not obtrusive at all but it’s still wholly unnecessary thing to do.

Fortunately the update checker can be turned of but it isn’t as easy as it could be. You can add a

-Dorg.terracotta.quartz.skipUpdateCheck=true

startup parameter or you can add

org.terracotta.quartz.skipUpdateCheck=true

to quartz.properties file to disable the update checker. Though both of these methods are unusable in my case.

I don’t want to add custom startup parameters and having only the update checker line in quartz.properties doesn’t work since you’re then missing the default settings. The only usable way disable the update checker was to add

System.setProperty("org.terracotta.quartz.skipUpdateCheck", "true");

call to the initialization code. This is basicly the same thing as adding the startup parameter, but this way you don’t have to fiddle with application server startup parameters.