From f2733999de7b5f9b8129aef857fb952039d23c5b Mon Sep 17 00:00:00 2001 From: Ron Anderson Date: Wed, 28 May 2014 10:09:12 -0500 Subject: [PATCH] Omaha #3110 Permanent fix for mutable database creation. Former-commit-id: 4633de4ea3b030a8fd9abc47792212ec93ab2737 [formerly a0001c9ed3d414237069f43a29dd907111c16832] Former-commit-id: b7271025f976f8d8c2072ad7b3daff3acbf97375 --- .../raytheon/viz/gfe/core/DataManager.java | 3 +- .../gfe/core/internal/NotificationRouter.java | 29 +++++++++++++++---- .../viz/gfe/core/internal/ParmManager.java | 8 +---- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/DataManager.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/DataManager.java index 82f79583a5..98ad06e5cf 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/DataManager.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/DataManager.java @@ -100,6 +100,7 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager; * 09/05/2013 2307 dgilling Use better PythonScript constructor. * 09/16/2013 2033 dgilling Remove unused IToolController. * 12/09/2013 2367 dgilling Instantiate ProcedureJobPool here. + * 05/22/2014 3110 randerso Attach router to edex.alerts.gfe earlier * * * @@ -218,6 +219,7 @@ public class DataManager { discriminator); this.client = new IFPClient(VizApp.getWsId(), this); this.router = new NotificationRouter(this.getSiteID()); + NotificationManagerJob.addObserver("edex.alerts.gfe", this.router); this.parmManager = new ParmManager(this); GFEParmCacheInitJob cacheJob = new GFEParmCacheInitJob(this.parmManager); @@ -267,7 +269,6 @@ public class DataManager { enableISCsend(true); } // this.queryString = "siteID='" + this.getSiteID() + "'"; - NotificationManagerJob.addObserver("edex.alerts.gfe", this.router); this.router.start(); this.parmOp = new ParmOp(this); diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/NotificationRouter.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/NotificationRouter.java index 049c5e6f20..4de4991969 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/NotificationRouter.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/NotificationRouter.java @@ -21,6 +21,7 @@ package com.raytheon.viz.gfe.core.internal; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -48,6 +49,9 @@ import com.raytheon.viz.gfe.Activator; * Jun 11, 2008 chammack Initial creation * Sep 03, 2008 1448 chammack Implement refactored interface * Mar 01, 2012 #346 dgilling Use identity-based ListenerLists. + * May 22, 2014 #3110 randerso Queue messages received prior to start rather + * than dropping them on the foor + * * * * @author chammack @@ -64,11 +68,14 @@ public class NotificationRouter implements INotificationObserver { private String siteID; + private List messageList; + /** * Constructor */ public NotificationRouter(String siteID) { this.siteID = siteID; + this.messageList = new LinkedList(); this.observers = new ListenerList(ListenerList.IDENTITY); this.observers .add(new AbstractGFENotificationObserver( @@ -173,7 +180,13 @@ public class NotificationRouter implements INotificationObserver { * Start routing */ public void start() { - this.isReady = true; + synchronized (this) { + this.isReady = true; + } + + for (NotificationMessage[] messages : messageList) { + notificationArrived(messages); + } } /** @@ -185,10 +198,16 @@ public class NotificationRouter implements INotificationObserver { // If DataManager is not initialized yet, do not start listening if (!isReady) { - statusHandler - .handle(Priority.VERBOSE, - "Notification messages skipped because router is not started"); - return; + synchronized (this) { + if (!isReady) { + this.messageList.add(messages); + statusHandler + .handle(Priority.VERBOSE, + messages.length + + "notification messages queued because router is not started"); + return; + } + } } for (NotificationMessage message : messages) { diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java index 2e8a40b35f..d4257170b3 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java @@ -141,8 +141,7 @@ import com.raytheon.viz.gfe.types.MutableInteger; * to simplify maintenance of this class. * Changed handling of enabling/disabling Topo parm * 04/02/2014 #2969 randerso Fix error when Toop parm is unloaded. - * 05/01/2014 #3105 dgilling Ensure mutable db gets into availableServerDatabases - * if it has to be created during ParmManager construction. + * 05/28/2014 #3110 randerso Remove #3105 changes * * * @author chammack @@ -1316,11 +1315,6 @@ public class ParmManager implements IParmManager, IMessageClient { ServerResponse sr = this.dataManager.getClient() .createNewDb(mutableDbId); containsMutable = sr.isOkay(); - - if (containsMutable) { - this.availableServerDatabases.add(mutableDbId); - Collections.sort(this.availableServerDatabases); - } } if (containsMutable) {