Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Use SLF4j properly #43

Closed
lordbuddha opened this issue Nov 8, 2013 · 2 comments
Closed

Use SLF4j properly #43

lordbuddha opened this issue Nov 8, 2013 · 2 comments

Comments

@lordbuddha
Copy link
Contributor

Don't do this:-

BasicDBObject query = new BasicDBObject();
query.put(TRIGGER_NEXT_FIRE_TIME, new BasicDBObject("$lte", new Date(noLaterThan)));

if (log.isDebugEnabled()) {
  log.debug("Finding up to " + maxCount + " triggers which have time less than " + new Date(noLaterThan));
}

Do this:-

Date noLaterThanDate = new Date();
BasicDBObject query = new BasicDBObject();
query.put(TRIGGER_NEXT_FIRE_TIME, new BasicDBObject("$lte", noLaterThanDate));

log.debug("Finding up to {} triggers which have time less than {}", maxCount, noLaterThanDate);

i.e. you don't really need those isDebugEnabled calls if you are using the SLF4j eith {} instead of string concatenation.

... And only create the noLaterThanDate once rather than twice as it was prior.

@michaelklishin
Copy link
Owner

@lordbuddha feel free to submit a pull request.

@michaelklishin
Copy link
Owner

Should be fixed in a3917a5.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants