Martin Peřina has uploaded a new change for review. Change subject: tools: Notifier code cleanup ......................................................................
tools: Notifier code cleanup Removes unused attribute log in NotificationProperties. Removes unused attribute pidFile in EngineMonitorService. Removes unnecessary @SuppressWarning in Notifier. Reformats code in Notifier. Change-Id: I0ddf6dbb01baa0e3fd1a8349f26aead0cd6a5fde Signed-off-by: Martin Perina <mper...@redhat.com> --- M backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/EngineMonitorService.java M backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/Notifier.java M backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java 3 files changed, 5 insertions(+), 13 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/68/22468/1 diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/EngineMonitorService.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/EngineMonitorService.java index cb3bd85..829d92c 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/EngineMonitorService.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/EngineMonitorService.java @@ -58,8 +58,8 @@ private boolean sslIgnoreCertErrors; private SSLSocketFactory sslFactory = null; private boolean sslIgnoreHostVerification; - private String pidFile; private static final HostnameVerifier IgnoredHostnameVerifier = new HostnameVerifier() { + @Override public boolean verify(String hostname, SSLSession session) { return true; } @@ -77,8 +77,6 @@ initServerConnectivity(); initServerMonitorInterval(); serverMonitorRetries = prop.getInteger(NotificationProperties.ENGINE_MONITOR_RETRIES); - pidFile = prop.getProperty(NotificationProperties.ENGINE_PID); - // Boolean.valueOf always returns false unless gets a true expression. repeatNonResponsiveNotification = this.prop.getBoolean(NotificationProperties.REPEAT_NON_RESPONSIVE_NOTIFICATION); if (log.isDebugEnabled()) { log.debug(MessageFormat.format("Checking server status using {0}, {1}ignoring SSL errors.", diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/Notifier.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/Notifier.java index b21c82b..c91dca3 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/Notifier.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/Notifier.java @@ -20,10 +20,9 @@ /** * Main class of event notification service. Initiate the service and handles termination signals */ -@SuppressWarnings("restriction") public class Notifier { - private static final Logger log = Logger.getLogger(Notifier.class); + private static ScheduledExecutorService notifyScheduler = Executors.newSingleThreadScheduledExecutor(); private static ScheduledExecutorService monitorScheduler = Executors.newSingleThreadScheduledExecutor(); @@ -49,19 +48,18 @@ */ public static void main(String[] args) { initLogging(); + NotifierSignalHandler handler = new NotifierSignalHandler(); handler.addScheduledExecutorService(notifyScheduler); handler.addScheduledExecutorService(monitorScheduler); Runtime.getRuntime().addShutdownHook(handler); - NotificationService notificationService = null; - EngineMonitorService engineMonitorService = null; try { NotificationProperties prop = NotificationProperties.getInstance(); prop.validate(); - notificationService = new NotificationService(prop); - engineMonitorService = new EngineMonitorService(prop); + NotificationService notificationService = new NotificationService(prop); + EngineMonitorService engineMonitorService = new EngineMonitorService(prop); // add notification service to scheduler with its configurable interval handler.addServiceHandler(notifyScheduler.scheduleWithFixedDelay(notificationService, @@ -86,7 +84,6 @@ * program. */ public static class NotifierSignalHandler extends Thread { - private List<ScheduledFuture<?>> serviceHandler = new ArrayList<ScheduledFuture<?>>(); private List<ScheduledExecutorService> scheduler = new ArrayList<ScheduledExecutorService>(); diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java index aeb3dc7..5142ab7 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java @@ -5,7 +5,6 @@ import javax.mail.internet.InternetAddress; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; import org.ovirt.engine.core.utils.LocalConfig; /** @@ -73,8 +72,6 @@ * and then once every failedQueriesNotificationThreshold times. */ public static final String FAILED_QUERIES_NOTIFICATION_THRESHOLD = "FAILED_QUERIES_NOTIFICATION_THRESHOLD"; - - private static final Logger log = Logger.getLogger(NotificationProperties.class); // Default files for defaults and overridden values: private static String DEFAULTS_PATH = "/usr/share/ovirt-engine/conf/notifier.conf.defaults"; -- To view, visit http://gerrit.ovirt.org/22468 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0ddf6dbb01baa0e3fd1a8349f26aead0cd6a5fde Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Peřina <mper...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches