USERGRID-1273: LockManager fix for OnlyOnceJob.

Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/4326b105
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/4326b105
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/4326b105

Branch: refs/heads/master
Commit: 4326b105e6039b608969578e927e634e3f2eb620
Parents: 9f45130
Author: Mike Dunker <mdun...@apigee.com>
Authored: Wed Apr 6 20:12:58 2016 -0700
Committer: Mike Dunker <mdun...@apigee.com>
Committed: Wed Apr 6 20:12:58 2016 -0700

----------------------------------------------------------------------
 .../org/apache/usergrid/batch/job/OnlyOnceJob.java     | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/4326b105/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 f857d05..82e856d 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
@@ -19,7 +19,7 @@ package org.apache.usergrid.batch.job;
 
 import java.util.concurrent.TimeUnit;
 
-import org.elasticsearch.common.inject.Inject;
+import com.google.inject.Injector;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.apache.usergrid.batch.Job;
@@ -28,6 +28,8 @@ import org.apache.usergrid.locking.Lock;
 import org.apache.usergrid.locking.LockManager;
 import org.apache.usergrid.persistence.EntityManagerFactory;
 
+import javax.annotation.PostConstruct;
+
 
 /**
  * Simple abstract job class that performs additional locking to ensure that 
the job is only executing once. This can be
@@ -38,12 +40,14 @@ import org.apache.usergrid.persistence.EntityManagerFactory;
 @Component("OnlyOnceJob")
 public abstract class OnlyOnceJob implements Job {
 
-    @Inject
     private LockManager lockManager;
 
     @Autowired
     private EntityManagerFactory emf;
 
+    @Autowired
+    private Injector injector;
+
 
     /**
      *
@@ -51,6 +55,11 @@ public abstract class OnlyOnceJob implements Job {
     public OnlyOnceJob() {
     }
 
+    @PostConstruct
+    public void initLockManager() throws Exception {
+        this.lockManager = injector.getInstance(LockManager.class);
+    }
+
 
     /*
      * (non-Javadoc)

Reply via email to