Browse Source

Watcher: Remove TriggerEngine.getJobCount() (#30395)

Since adding back the per-watch statistics, we do not need to access
every trigger engine implementation to get the current total job count.
This commit removes the unused methods to do so.
Alexander Reelsen 7 years ago
parent
commit
ed2d427c48

+ 1 - 1
x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpRequest.java

@@ -511,7 +511,7 @@ public class HttpRequest implements ToXContentObject {
      * @param params         The ToXContentParams from the parent write
      * @param params         The ToXContentParams from the parent write
      * @param excludeField   The field to exclude
      * @param excludeField   The field to exclude
      * @return               A bytearrayinputstream that contains the serialized request
      * @return               A bytearrayinputstream that contains the serialized request
-     * @throws IOException
+     * @throws IOException   if an IOException is triggered in the underlying toXContent method
      */
      */
     public static InputStream filterToXContent(HttpRequest request, XContent xContent, ToXContent.Params params,
     public static InputStream filterToXContent(HttpRequest request, XContent xContent, ToXContent.Params params,
                                                String excludeField) throws IOException {
                                                String excludeField) throws IOException {

+ 0 - 5
x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerEngine.java

@@ -37,11 +37,6 @@ public interface TriggerEngine<T extends Trigger, E extends TriggerEvent> {
      */
      */
     void pauseExecution();
     void pauseExecution();
 
 
-    /**
-     * Returns the number of active jobs currently in this trigger engine implementation
-     */
-    int getJobCount();
-
     /**
     /**
      * Removes the job associated with the given name from this trigger engine.
      * Removes the job associated with the given name from this trigger engine.
      *
      *

+ 0 - 5
x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/manual/ManualTriggerEngine.java

@@ -52,11 +52,6 @@ public class ManualTriggerEngine implements TriggerEngine<ManualTrigger, ManualT
     public void pauseExecution() {
     public void pauseExecution() {
     }
     }
 
 
-    @Override
-    public int getJobCount() {
-        return 0;
-    }
-
     @Override
     @Override
     public boolean remove(String jobId) {
     public boolean remove(String jobId) {
         return false;
         return false;

+ 0 - 5
x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleTriggerEngine.java

@@ -77,11 +77,6 @@ public class TickerScheduleTriggerEngine extends ScheduleTriggerEngine {
         schedules.put(watch.id(), new ActiveSchedule(watch.id(), trigger.getSchedule(), clock.millis()));
         schedules.put(watch.id(), new ActiveSchedule(watch.id(), trigger.getSchedule(), clock.millis()));
     }
     }
 
 
-    @Override
-    public int getJobCount() {
-        return schedules.size();
-    }
-
     @Override
     @Override
     public boolean remove(String jobId) {
     public boolean remove(String jobId) {
         return schedules.remove(jobId) != null;
         return schedules.remove(jobId) != null;

+ 0 - 5
x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/ScheduleTriggerEngineMock.java

@@ -71,11 +71,6 @@ public class ScheduleTriggerEngineMock extends ScheduleTriggerEngine {
         watches.clear();
         watches.clear();
     }
     }
 
 
-    @Override
-    public int getJobCount() {
-        return watches.size();
-    }
-
     @Override
     @Override
     public boolean remove(String jobId) {
     public boolean remove(String jobId) {
         return watches.remove(jobId) != null;
         return watches.remove(jobId) != null;

+ 0 - 5
x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchTests.java

@@ -671,11 +671,6 @@ public class WatchTests extends ESTestCase {
         public void pauseExecution() {
         public void pauseExecution() {
         }
         }
 
 
-        @Override
-        public int getJobCount() {
-            return 0;
-        }
-
         @Override
         @Override
         public boolean remove(String jobId) {
         public boolean remove(String jobId) {
             return false;
             return false;