Added one-time job logging.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/021fcba6 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/021fcba6 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/021fcba6 Branch: refs/heads/release-2.1.1 Commit: 021fcba68c013414261f3e123d7ec6db8dc938fe Parents: 55271ce Author: Mike Dunker <mdun...@apigee.com> Authored: Thu Apr 7 16:52:13 2016 -0700 Committer: Mike Dunker <mdun...@apigee.com> Committed: Thu Apr 7 16:52:13 2016 -0700 ---------------------------------------------------------------------- .../java/org/apache/usergrid/batch/job/OnlyOnceJob.java | 10 ++++++++++ 1 file changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/021fcba6/stack/core/src/main/java/org/apache/usergrid/batch/job/OnlyOnceJob.java ---------------------------------------------------------------------- diff --git a/stack/core/src/main/java/org/apache/usergrid/batch/job/OnlyOnceJob.java b/stack/core/src/main/java/org/apache/usergrid/batch/job/OnlyOnceJob.java index afbddc3..6d927b9 100644 --- a/stack/core/src/main/java/org/apache/usergrid/batch/job/OnlyOnceJob.java +++ b/stack/core/src/main/java/org/apache/usergrid/batch/job/OnlyOnceJob.java @@ -27,6 +27,8 @@ import org.apache.usergrid.batch.JobExecution; import org.apache.usergrid.locking.Lock; import org.apache.usergrid.locking.LockManager; import org.apache.usergrid.persistence.EntityManagerFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.annotation.PostConstruct; @@ -40,6 +42,8 @@ import javax.annotation.PostConstruct; @Component("OnlyOnceJob") public abstract class OnlyOnceJob implements Job { + private static final Logger logger = LoggerFactory.getLogger(OnlyOnceJob.class); + private LockManager lockManager; @Autowired @@ -58,6 +62,11 @@ public abstract class OnlyOnceJob implements Job { @PostConstruct public void initLockManager() throws Exception { this.lockManager = injector.getInstance(LockManager.class); + if (lockManager != null) { + logger.info("LockManager injection successful"); + } else { + logger.error("LockManager injection unsuccessful"); + } } /* @@ -68,6 +77,7 @@ public abstract class OnlyOnceJob implements Job { @Override public void execute( JobExecution execution ) throws Exception { + logger.info("Executing one-time job, LockManager is {}" lockManager == null ? "null" : "not null"); String lockId = execution.getJobId().toString(); Lock lock = lockManager.createLock( emf.getManagementAppId(), String.format( "/jobs/%s", lockId ) );