diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-01-28 18:06:14 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-02-02 20:50:17 +0100 |
commit | 7bcccf0899d7bfa9f4d1782b4f5699c1f896502f (patch) | |
tree | 33aad9ea69c0021d1c174baf707d8d9e79bc4e53 /sonar-plugin-api/src | |
parent | 8430a7ff14f49de0c395db1573cadea076c42779 (diff) | |
download | sonarqube-7bcccf0899d7bfa9f4d1782b4f5699c1f896502f.tar.gz sonarqube-7bcccf0899d7bfa9f4d1782b4f5699c1f896502f.zip |
SONAR-6113 Short-circuit sending of notifications when there are no subscribers
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java | 10 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java | 9 |
2 files changed, 14 insertions, 5 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java index aa04f52069a..0666e7260f1 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java @@ -20,11 +20,10 @@ package org.sonar.api.notifications; import com.google.common.collect.Maps; -import org.apache.commons.lang.builder.ReflectionToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; import javax.annotation.CheckForNull; import javax.annotation.Nullable; + import java.io.Serializable; import java.util.Map; @@ -140,7 +139,10 @@ public class Notification implements Serializable { @Override public String toString() { - return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); + StringBuilder sb = new StringBuilder("Notification{"); + sb.append("type='").append(type).append('\''); + sb.append(", fields=").append(fields); + sb.append('}'); + return sb.toString(); } - } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java index b4bff26e29f..5ad0be8ed66 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java @@ -39,7 +39,7 @@ import org.sonar.api.ServerExtension; */ public abstract class NotificationDispatcher implements ServerExtension { - private String notificationType; + private final String notificationType; /** * Additional information related to the notification, which will be used @@ -92,6 +92,13 @@ public abstract class NotificationDispatcher implements ServerExtension { } /** + * @since 5.1 + */ + public String getType() { + return notificationType; + } + + /** * <p> * Performs the dispatch. * </p> |