GEODE-1949: Remove the dependency on quartz from the rebalancer

The geode-rebalancer does not need to depend on quartz, it is using
spring-expression for all of the cron heavy lifting.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/22afc3bd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/22afc3bd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/22afc3bd

Branch: refs/heads/feature/e2e-testing
Commit: 22afc3bd740241e53444dec2fd30ea39fa15c5dc
Parents: 9316255
Author: Dan Smith <upthewatersp...@apache.org>
Authored: Thu Sep 29 10:33:17 2016 -0700
Committer: Dan Smith <upthewatersp...@apache.org>
Committed: Thu Sep 29 14:50:03 2016 -0700

----------------------------------------------------------------------
 geode-rebalancer/build.gradle                            |  8 ++++----
 .../java/org/apache/geode/cache/util/AutoBalancer.java   | 11 +++++++----
 2 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/22afc3bd/geode-rebalancer/build.gradle
----------------------------------------------------------------------
diff --git a/geode-rebalancer/build.gradle b/geode-rebalancer/build.gradle
index 00c43e4..cf129a5 100644
--- a/geode-rebalancer/build.gradle
+++ b/geode-rebalancer/build.gradle
@@ -19,10 +19,10 @@ dependencies {
   provided project(':geode-common')
   provided project(':geode-core')
 
-  compile ('org.quartz-scheduler:quartz:' + project.'quartz.version') {
-    exclude module: 'c3p0'
-    exclude module: 'slf4j-api'
+  compile ('org.springframework:spring-context:' + 
project.'springframework.version') {
+    exclude module: 'spring-beans'
+    exclude module: 'spring-expression'
+    exclude module: 'spring-aop'
   }
-  compile ('org.springframework:spring-context:' + 
project.'springframework.version')
   testCompile project(':geode-junit')
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/22afc3bd/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
----------------------------------------------------------------------
diff --git 
a/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java 
b/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
index 98c5237..b95b99e 100644
--- 
a/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
+++ 
b/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
@@ -28,8 +28,8 @@ import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.geode.annotations.Experimental;
 import org.apache.logging.log4j.Logger;
-import org.quartz.CronExpression;
 import org.springframework.scheduling.support.CronSequenceGenerator;
 
 import org.apache.geode.GemFireConfigException;
@@ -72,6 +72,7 @@ import org.apache.geode.internal.logging.LogService;
  * <LI>TBD THRESHOLDS
  * 
  */
+@Experimental("The autobalancer may be removed or the API may change in future 
releases")
 public class AutoBalancer implements Declarable {
   /**
    * Use this configuration to manage out-of-balance audit frequency. If the
@@ -202,10 +203,12 @@ public class AutoBalancer implements Declarable {
       if (schedule == null || schedule.isEmpty()) {
         throw new GemFireConfigException("Missing configuration: " + SCHEDULE);
       }
-      if (!CronExpression.isValidExpression(schedule)) {
-        throw new GemFireConfigException("Invalid schedule: " + schedule);
+
+      try {
+        generator = new CronSequenceGenerator(schedule);
+      } catch(Exception e) {
+        throw new GemFireConfigException("Cron expression could not be parsed: 
" + schedule, e);
       }
-      generator = new CronSequenceGenerator(schedule);
 
       submitNext();
     }

Reply via email to