cziegeler commented on code in PR #22:
URL: 
https://github.com/apache/sling-org-apache-sling-event/pull/22#discussion_r890855478


##########
src/main/java/org/apache/sling/event/impl/jobs/scheduling/JobScheduleBuilderImpl.java:
##########
@@ -117,4 +126,31 @@ public ScheduleBuilder suspend() {
         this.suspend = true;
         return this;
     }
+
+    /**
+     * In case a scheduleName was not provided we calculate on based on the 
available
+     * data so we can detect duplicates.
+     * @return a value which is identical for identical jobs
+     */
+    private String deriveScheduleName() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("topic="+topic)
+            .append(",suspend=" + suspend)
+            .append(",");
+
+        if (properties != null) {
+            // sort the properties and flatten them into a string
+            List<String> keys = new ArrayList<>(properties.keySet());
+            Collections.sort(keys);
+            for (String key: keys) {
+                
sb.append(key).append("=").append(properties.get(key)).append(",");
+            }
+        }
+        // append all schedules
+        sb.append("schedules=").append(schedules);
+
+        String hashCode = new String("" + sb.toString().hashCode());

Review Comment:
   String.valueOf ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to