On Thu, Apr 22, 2021 at 7:36 AM Wayne Gemmell | Connect <
wa...@connect-mobile.co.za> wrote:

> Hi Will
>
> Thanks for the feedback. I've changed my app to be a war. It was
> surprisingly easy. What should I watch out for in terms of changes?
> I presumy my timer beans will have to be replaced by cron jobs. Is there
> anything else that may sneak up on me. I'm starting testing at the moment.
>

Yes, timer beans are another thing.

IMHO, Timer beans are "OK", but I've had more issues with them than not
over the years, particularly in a clustered/load balanced environment. Most
timer beans are not just singletons, but cluster wide singletons. So
there's hoop jumping involved to handle that.

The idea of a cron job is sound. Today, I would just use a cron job to
tickle a simple web service trigger to start the job. This has the
advantage that in a load balanced environment, you point this to the
frontend load balancer, and any one of the backends handles the job. This
solves the problem of not having to worry about which machine controls the
timer beans, having to orchestrate which ones are doing what, prevents
having the master node problem of "we'll run timer beans on node 1", which
is fine until node 1 is down for some reason.

The dark side of cron jobs is that they will run whether the previous job
has completed or not. Not a problem for a report that runs at 2am, but can
be a problem for something that runs every 1 minute, or 5 minutes. Also,
cron only has 1m resolution.

So, that's a concern as well. All of these have issues, you just have to
pick what fits you best.

Best part about a URL triggered job is if something goes awry, you can just
kick off the job manually. Harder to do that with timer beans.

You can also look into the Quartz library, it's a java based package that
can do cron like things, if that's of interest. (Cron is still probably a
better idea, because it's so easy to configure vs restarting an app.)

Other than that, if you're not using those EJB artifacts, like MDBs, JCA,
Timers, it should go well. I've never used the new Batch facility, I don't
know where it lives.

A single WAR certainly can simplify things.

Regards,

Will Hartung

Reply via email to