You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by vd...@apache.org on 2016/04/11 21:58:38 UTC

incubator-quarks git commit: QUARKS-XXXX description vdogaru closes #85

Repository: incubator-quarks
Updated Branches:
  refs/heads/master 6cef2ebfe -> 0a95f3091


QUARKS-XXXX description vdogaru closes #85


Project: http://git-wip-us.apache.org/repos/asf/incubator-quarks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quarks/commit/0a95f309
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quarks/tree/0a95f309
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quarks/diff/0a95f309

Branch: refs/heads/master
Commit: 0a95f3091afdc4f62abb9ffe82afa45d4a39781c
Parents: 6cef2eb
Author: Victor Dogaru <vd...@apache.org>
Authored: Mon Apr 11 12:57:58 2016 -0700
Committer: Victor Dogaru <vd...@apache.org>
Committed: Mon Apr 11 12:57:58 2016 -0700

----------------------------------------------------------------------
 .../execution/services/JobRegistryService.java  | 125 +++++++++++++++++++
 .../services/job/JobRegistryService.java        | 125 -------------------
 .../java/quarks/apps/runtime/JobMonitorApp.java |   2 +-
 .../quarks/apps/runtime/JobMonitorAppEvent.java |   2 +-
 .../java/quarks/runtime/etiao/EtiaoJob.java     |   2 +-
 .../quarks/runtime/jobregistry/JobEvents.java   |   4 +-
 .../quarks/runtime/jobregistry/JobRegistry.java |   2 +-
 .../runtime/jobregistry/JobRegistryTest.java    |   4 +-
 .../samples/topology/JobEventsSample.java       |   2 +-
 9 files changed, 134 insertions(+), 134 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/0a95f309/api/execution/src/main/java/quarks/execution/services/JobRegistryService.java
----------------------------------------------------------------------
diff --git a/api/execution/src/main/java/quarks/execution/services/JobRegistryService.java b/api/execution/src/main/java/quarks/execution/services/JobRegistryService.java
new file mode 100644
index 0000000..d379f17
--- /dev/null
+++ b/api/execution/src/main/java/quarks/execution/services/JobRegistryService.java
@@ -0,0 +1,125 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+package quarks.execution.services;
+
+import java.util.Set;
+
+import quarks.execution.Job;
+import quarks.function.BiConsumer;
+
+/**
+ * Job registry service. 
+ * <p>
+ * Keeps the list of {@link Job} instances registered by the runtime and 
+ * provides the necessary methods to register and remove jobs, access 
+ * registered jobs, as well as register listeners which are notified on job 
+ * registrations, removals, and updates.
+ * The following event types are sent to registered listeners:
+ * <ul>
+ * <li>An {@link EventType#ADD} event is sent when a job is added.</li>
+ * <li>An {@link EventType#REMOVE} event is sent when a job is removed.</li>
+ * <li>An {@link EventType#UPDATE} event is sent when a job is updated.</li>
+ * </ul>
+ * <p>
+ * <h3>Event dispatch</h3>
+ * If a listener invocation throws an Exception, then the exception
+ * will not prevent the remaining listeners from being invoked. However, 
+ * if the invocation throws an Error, then it is recommended that 
+ * the event dispatch stop.
+ */
+public interface JobRegistryService {
+    /**
+     * Job event types.
+     */
+    enum EventType {
+        /** A Job has been added to the registry. */
+        ADD,
+        /** A Job has been removed from the registry. */
+        REMOVE,
+        /** A registered Job has been updated. */
+        UPDATE
+    }
+
+    /**
+     * Adds a handler to a collection of listeners that will be notified
+     * on job registration and state changes.  Listeners will be notified 
+     * in the order in which they are added.
+     * <p>
+     * A listener is notified of all existing jobs when it is first added.
+     *
+     * @param listener the listener that will be added
+     * @throws IllegalArgumentException if the listener parameter is 
+     *      {@code null}
+     */
+    void addListener(BiConsumer<JobRegistryService.EventType, Job> listener)
+            throws IllegalArgumentException;
+
+    /**
+     * Removes a handler from this registry's collection of listeners.
+     *
+     * @param listener the listener that will be removed
+     * @return whether or not the listener has been removed
+     */
+    boolean removeListener(
+            BiConsumer<JobRegistryService.EventType, Job> listener);
+
+    /**
+     * Returns a set of all the registered job identifiers.
+     *
+     * @return the identifiers of all the jobs
+     */
+    Set<String> getJobIds();
+
+    /**
+     * Returns a job given its identifier.
+     *
+     * @return the job or {@code null} if no job is registered with that 
+     *      identifier.
+     */
+    Job getJob(String id);
+
+    /**
+     * Adds the specified job.
+     *
+     * @param job the job to register
+     *
+     * @throws IllegalArgumentException if a job is null, or if a job with 
+     *      the same identifier is already registered
+     */
+    void addJob(Job job) throws IllegalArgumentException;
+
+    /**
+     * Removes the job specified by the given identifier.
+     *
+     * @param jobId the identifier of the job to remove
+     * @return whether or not the job was removed
+     */
+    boolean removeJob(String jobId);
+
+    /**
+     * Notifies listeners that the specified registered job has 
+     * been updated.
+     *
+     * @param job the job
+     * @return whether or not the job was found in the registry
+     */
+    boolean updateJob(Job job);
+
+    // TODO add job retrieval given its name
+}

http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/0a95f309/api/execution/src/main/java/quarks/execution/services/job/JobRegistryService.java
----------------------------------------------------------------------
diff --git a/api/execution/src/main/java/quarks/execution/services/job/JobRegistryService.java b/api/execution/src/main/java/quarks/execution/services/job/JobRegistryService.java
deleted file mode 100644
index 0233128..0000000
--- a/api/execution/src/main/java/quarks/execution/services/job/JobRegistryService.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
-*/
-package quarks.execution.services.job;
-
-import java.util.Set;
-
-import quarks.execution.Job;
-import quarks.function.BiConsumer;
-
-/**
- * Job registry service. 
- * <p>
- * Keeps the list of {@link Job} instances registered by the runtime and 
- * provides the necessary methods to register and remove jobs, access 
- * registered jobs, as well as register listeners which are notified on job 
- * registrations, removals, and updates.
- * The following event types are sent to registered listeners:
- * <ul>
- * <li>An {@link EventType#ADD} event is sent when a job is added.</li>
- * <li>An {@link EventType#REMOVE} event is sent when a job is removed.</li>
- * <li>An {@link EventType#UPDATE} event is sent when a job is updated.</li>
- * </ul>
- * <p>
- * <h3>Event dispatch</h3>
- * If a listener invocation throws an Exception, then the exception
- * will not prevent the remaining listeners from being invoked. However, 
- * if the invocation throws an Error, then it is recommended that 
- * the event dispatch stop.
- */
-public interface JobRegistryService {
-    /**
-     * Job event types.
-     */
-    enum EventType {
-        /** A Job has been added to the registry. */
-        ADD,
-        /** A Job has been removed from the registry. */
-        REMOVE,
-        /** A registered Job has been updated. */
-        UPDATE
-    }
-
-    /**
-     * Adds a handler to a collection of listeners that will be notified
-     * on job registration and state changes.  Listeners will be notified 
-     * in the order in which they are added.
-     * <p>
-     * A listener is notified of all existing jobs when it is first added.
-     *
-     * @param listener the listener that will be added
-     * @throws IllegalArgumentException if the listener parameter is 
-     *      {@code null}
-     */
-    void addListener(BiConsumer<JobRegistryService.EventType, Job> listener)
-            throws IllegalArgumentException;
-
-    /**
-     * Removes a handler from this registry's collection of listeners.
-     *
-     * @param listener the listener that will be removed
-     * @return whether or not the listener has been removed
-     */
-    boolean removeListener(
-            BiConsumer<JobRegistryService.EventType, Job> listener);
-
-    /**
-     * Returns a set of all the registered job identifiers.
-     *
-     * @return the identifiers of all the jobs
-     */
-    Set<String> getJobIds();
-
-    /**
-     * Returns a job given its identifier.
-     *
-     * @return the job or {@code null} if no job is registered with that 
-     *      identifier.
-     */
-    Job getJob(String id);
-
-    /**
-     * Adds the specified job.
-     *
-     * @param job the job to register
-     *
-     * @throws IllegalArgumentException if a job is null, or if a job with 
-     *      the same identifier is already registered
-     */
-    void addJob(Job job) throws IllegalArgumentException;
-
-    /**
-     * Removes the job specified by the given identifier.
-     *
-     * @param jobId the identifier of the job to remove
-     * @return whether or not the job was removed
-     */
-    boolean removeJob(String jobId);
-
-    /**
-     * Notifies listeners that the specified registered job has 
-     * been updated.
-     *
-     * @param job the job
-     * @return whether or not the job was found in the registry
-     */
-    boolean updateJob(Job job);
-
-    // TODO add job retrieval given its name
-}

http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/0a95f309/apps/runtime/src/main/java/quarks/apps/runtime/JobMonitorApp.java
----------------------------------------------------------------------
diff --git a/apps/runtime/src/main/java/quarks/apps/runtime/JobMonitorApp.java b/apps/runtime/src/main/java/quarks/apps/runtime/JobMonitorApp.java
index f09b660..8e798c9 100644
--- a/apps/runtime/src/main/java/quarks/apps/runtime/JobMonitorApp.java
+++ b/apps/runtime/src/main/java/quarks/apps/runtime/JobMonitorApp.java
@@ -31,8 +31,8 @@ import com.google.gson.JsonObject;
 import quarks.execution.DirectSubmitter;
 import quarks.execution.Job;
 import quarks.execution.services.ControlService;
+import quarks.execution.services.JobRegistryService;
 import quarks.execution.services.RuntimeServices;
-import quarks.execution.services.job.JobRegistryService;
 import quarks.function.Consumer;
 import quarks.function.Supplier;
 import quarks.runtime.jobregistry.JobEvents;

http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/0a95f309/apps/runtime/src/main/java/quarks/apps/runtime/JobMonitorAppEvent.java
----------------------------------------------------------------------
diff --git a/apps/runtime/src/main/java/quarks/apps/runtime/JobMonitorAppEvent.java b/apps/runtime/src/main/java/quarks/apps/runtime/JobMonitorAppEvent.java
index 985e0cb..9ab95fb 100644
--- a/apps/runtime/src/main/java/quarks/apps/runtime/JobMonitorAppEvent.java
+++ b/apps/runtime/src/main/java/quarks/apps/runtime/JobMonitorAppEvent.java
@@ -22,7 +22,7 @@ import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 
 import quarks.execution.Job;
-import quarks.execution.services.job.JobRegistryService;
+import quarks.execution.services.JobRegistryService;
 
 /**
  * Helpers for parsing generating and parsing a JSON representation of job

http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/0a95f309/runtime/etiao/src/main/java/quarks/runtime/etiao/EtiaoJob.java
----------------------------------------------------------------------
diff --git a/runtime/etiao/src/main/java/quarks/runtime/etiao/EtiaoJob.java b/runtime/etiao/src/main/java/quarks/runtime/etiao/EtiaoJob.java
index 2574923..b5c1088 100644
--- a/runtime/etiao/src/main/java/quarks/runtime/etiao/EtiaoJob.java
+++ b/runtime/etiao/src/main/java/quarks/runtime/etiao/EtiaoJob.java
@@ -27,8 +27,8 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import quarks.execution.mbeans.JobMXBean;
 import quarks.execution.services.ControlService;
+import quarks.execution.services.JobRegistryService;
 import quarks.execution.services.ServiceContainer;
-import quarks.execution.services.job.JobRegistryService;
 import quarks.graph.spi.execution.AbstractGraphJob;
 import quarks.oplet.JobContext;
 import quarks.runtime.etiao.graph.DirectGraph;

http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/0a95f309/runtime/jobregistry/src/main/java/quarks/runtime/jobregistry/JobEvents.java
----------------------------------------------------------------------
diff --git a/runtime/jobregistry/src/main/java/quarks/runtime/jobregistry/JobEvents.java b/runtime/jobregistry/src/main/java/quarks/runtime/jobregistry/JobEvents.java
index 24fffd1..298450f 100644
--- a/runtime/jobregistry/src/main/java/quarks/runtime/jobregistry/JobEvents.java
+++ b/runtime/jobregistry/src/main/java/quarks/runtime/jobregistry/JobEvents.java
@@ -19,9 +19,9 @@ under the License.
 package quarks.runtime.jobregistry;
 
 import quarks.execution.Job;
+import quarks.execution.services.JobRegistryService;
 import quarks.execution.services.RuntimeServices;
-import quarks.execution.services.job.JobRegistryService;
-import quarks.execution.services.job.JobRegistryService.EventType;
+import quarks.execution.services.JobRegistryService.EventType;
 import quarks.function.BiConsumer;
 import quarks.function.BiFunction;
 import quarks.function.Consumer;

http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/0a95f309/runtime/jobregistry/src/main/java/quarks/runtime/jobregistry/JobRegistry.java
----------------------------------------------------------------------
diff --git a/runtime/jobregistry/src/main/java/quarks/runtime/jobregistry/JobRegistry.java b/runtime/jobregistry/src/main/java/quarks/runtime/jobregistry/JobRegistry.java
index 316d28c..c0a9804 100644
--- a/runtime/jobregistry/src/main/java/quarks/runtime/jobregistry/JobRegistry.java
+++ b/runtime/jobregistry/src/main/java/quarks/runtime/jobregistry/JobRegistry.java
@@ -29,8 +29,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import quarks.execution.Job;
+import quarks.execution.services.JobRegistryService;
 import quarks.execution.services.ServiceContainer;
-import quarks.execution.services.job.JobRegistryService;
 import quarks.function.BiConsumer;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/0a95f309/runtime/jobregistry/src/test/java/quarks/test/runtime/jobregistry/JobRegistryTest.java
----------------------------------------------------------------------
diff --git a/runtime/jobregistry/src/test/java/quarks/test/runtime/jobregistry/JobRegistryTest.java b/runtime/jobregistry/src/test/java/quarks/test/runtime/jobregistry/JobRegistryTest.java
index 7f00039..449c362 100644
--- a/runtime/jobregistry/src/test/java/quarks/test/runtime/jobregistry/JobRegistryTest.java
+++ b/runtime/jobregistry/src/test/java/quarks/test/runtime/jobregistry/JobRegistryTest.java
@@ -28,8 +28,8 @@ import java.util.concurrent.TimeoutException;
 import org.junit.Test;
 
 import quarks.execution.Job;
-import quarks.execution.services.job.JobRegistryService;
-import quarks.execution.services.job.JobRegistryService.EventType;
+import quarks.execution.services.JobRegistryService;
+import quarks.execution.services.JobRegistryService.EventType;
 import quarks.function.BiConsumer;
 import quarks.runtime.jobregistry.JobRegistry;
 

http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/0a95f309/samples/topology/src/main/java/quarks/samples/topology/JobEventsSample.java
----------------------------------------------------------------------
diff --git a/samples/topology/src/main/java/quarks/samples/topology/JobEventsSample.java b/samples/topology/src/main/java/quarks/samples/topology/JobEventsSample.java
index f0d4f28..df4e221 100644
--- a/samples/topology/src/main/java/quarks/samples/topology/JobEventsSample.java
+++ b/samples/topology/src/main/java/quarks/samples/topology/JobEventsSample.java
@@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit;
 import com.google.gson.JsonObject;
 
 import quarks.execution.Job;
-import quarks.execution.services.job.JobRegistryService;
+import quarks.execution.services.JobRegistryService;
 import quarks.providers.direct.DirectProvider;
 import quarks.runtime.jobregistry.JobEvents;
 import quarks.runtime.jobregistry.JobRegistry;