CRONs for Java: crontab4j

The first pre-stable version of my latest project crontab4j is now available.

What is it?

The name is plain enough: it allows you to schedule Java jobs using CRONs.

Before going further, keep in mind this version is a WIP. For instance, I heavily use regular expressions now (I love regexps), but I plan on moving to grammars to make things more scalable and easier to debug.

You said available?

Well, right. You can get the sources and compile it yourself, as any Maven project.

I might publish it to Maven later, when I get a stable 1.0.0 version. Until then, you will have to build by your own means.

Doesn’t it fit into the yet another category?

What does not, nowadays? Yes, I know of two other tools which can do the same.

Quartz

Quartz is the well-known Java scheduling library. It is not CRON-centric, but it is powerful and integrates nicely inside a Spring context.

This is why I actually suggested, but my boss thought it might be too much for a simple job. So I took the challenge and wrote a simple parser for him. And made something more elaborate on the side.

So, is it really lighter? It does less things, so it better be! At the current time:

  • Quartz: 645 KB
  • crontab4j: 45KB

And this does not include the transitive dependencies: the goal was to get rid of everything useless. Quartz has been progressing on this aspect, but just before version 2, it had nine dependencies, not counting the transitives. Now it only has two. I must wait to have a stable version before bragging.

cron4j

I did not know of cron4j before I looked to see if the name was already taken, which made me choose crontab4j to avoid confusion.

So, why did I persevere in making crontab4j? First, because I already had taken up the challenge. Second, because I keep in mind that most Java applications today use a Spring context, and therefore need compatible tools, which I aim to provide.

What’s next?

I have established a roadmap, you can see it along with the rest of the project: https://cychop.github.io/crontab4j/.

More to come…

How to determine the best implementation of a Java method?

Short answer

  1. Write alternative versions of the method you want to test. They should be named as the original, and suffixed with an index. The rest of the signature must not change.
  2. Download the java-implementation-comparer project from Github.
  3. Build it to add it to your local Maven repository: mvn install
  4. Create a test project importing both:
    • the project you want to test;
    • thejava-implementation-comparer:
  5. Create a test class and write the little code you need:
  6. Just enjoy your comparison:

Something more detailed

Continue reading How to determine the best implementation of a Java method?

Hello, World!

This blog has been idle for some time, as I was busy at work. Fortunately, I am getting active again, and wishing to share.

But now is the time to reboot. And I actually mean “reboot”: some of the old posts will be rewritten over the weeks. An archive was created to keep them available meanwhile.

And new content should begin popping up quite shortly. See you soon!

Image courtesy from Alcibiade (CC-Attribution 4.0)