diff --git a/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/ProcessUtil.java b/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/ProcessUtil.java index c2079f34e8..16eaef1f55 100644 --- a/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/ProcessUtil.java +++ b/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/ProcessUtil.java @@ -55,6 +55,8 @@ public class ProcessUtil { protected static final IUFStatusHandler handler = UFStatus .getNamedHandler("Ingest"); + protected static final EventBus eventBus = EventBus.getInstance(); + protected transient final static ThreadLocal FORMAT = new ThreadLocal() { @Override @@ -164,7 +166,7 @@ public class ProcessUtil { // error occurred and statement logged incorrectly if ((processEvent.getProcessingLatency() > 0) && (processEvent.getProcessingTime() > 0)) { - EventBus.getInstance().publish(processEvent); + eventBus.publish(processEvent); } // Make sure we have something to log. diff --git a/edexOsgi/com.raytheon.uf.edex.event/res/spring/event-common.xml b/edexOsgi/com.raytheon.uf.edex.event/res/spring/event-common.xml index 6acb725514..7619438902 100644 --- a/edexOsgi/com.raytheon.uf.edex.event/res/spring/event-common.xml +++ b/edexOsgi/com.raytheon.uf.edex.event/res/spring/event-common.xml @@ -5,11 +5,5 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.event/resources/eventBus.properties b/edexOsgi/com.raytheon.uf.edex.event/resources/eventBus.properties new file mode 100644 index 0000000000..5f0d71f7c5 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.event/resources/eventBus.properties @@ -0,0 +1,2 @@ +# Number of threads for async event bus +eventBusThreadCount=15 \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.event/src/com/raytheon/uf/edex/event/EventBus.java b/edexOsgi/com.raytheon.uf.edex.event/src/com/raytheon/uf/edex/event/EventBus.java index b4abaf34aa..e49b91ee8d 100644 --- a/edexOsgi/com.raytheon.uf.edex.event/src/com/raytheon/uf/edex/event/EventBus.java +++ b/edexOsgi/com.raytheon.uf.edex.event/src/com/raytheon/uf/edex/event/EventBus.java @@ -6,7 +6,6 @@ import com.google.common.eventbus.AsyncEventBus; import com.raytheon.uf.common.event.Event; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.edex.core.EDEXUtil; /** * @@ -36,11 +35,11 @@ public class EventBus { static { int threadCount = 15; try { - threadCount = Integer.parseInt((String) EDEXUtil - .getESBComponent("eventBusThreadCount")); + threadCount = Integer.parseInt(System.getProperty( + "eventBusThreadCount", "15")); } catch (Exception e) { - statusHandler.error( - "Unable to set thread pool size from spring; defaulting size to " + statusHandler + .error("Unable to set thread pool size from property eventBusThreadCount; defaulting size to " + threadCount + ".", e); } asyncEventBus = new AsyncEventBus("EventBus", diff --git a/edexOsgi/com.raytheon.uf.edex.registry.feature/.project b/edexOsgi/com.raytheon.uf.edex.registry.feature/.project deleted file mode 100644 index ed01c57c53..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.registry.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - com.raytheon.uf.edex.registry.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/edexOsgi/com.raytheon.uf.edex.stats/res/spring/stats-common.xml b/edexOsgi/com.raytheon.uf.edex.stats/res/spring/stats-common.xml index b65b190f93..420e3344a1 100644 --- a/edexOsgi/com.raytheon.uf.edex.stats/res/spring/stats-common.xml +++ b/edexOsgi/com.raytheon.uf.edex.stats/res/spring/stats-common.xml @@ -16,6 +16,5 @@ + class="com.raytheon.uf.edex.stats.handler.StatsHandler"/> diff --git a/edexOsgi/com.raytheon.uf.edex.stats/src/com/raytheon/uf/edex/stats/handler/StatsHandler.java b/edexOsgi/com.raytheon.uf.edex.stats/src/com/raytheon/uf/edex/stats/handler/StatsHandler.java index a8dd09b0d6..d4b6853ed2 100644 --- a/edexOsgi/com.raytheon.uf.edex.stats/src/com/raytheon/uf/edex/stats/handler/StatsHandler.java +++ b/edexOsgi/com.raytheon.uf.edex.stats/src/com/raytheon/uf/edex/stats/handler/StatsHandler.java @@ -19,6 +19,7 @@ **/ package com.raytheon.uf.edex.stats.handler; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -36,6 +37,7 @@ import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.edex.database.dao.CoreDao; import com.raytheon.uf.edex.database.dao.DaoConfig; import com.raytheon.uf.edex.event.EventBus; +import com.raytheon.uf.edex.stats.util.ConfigLoader; /** * Subscribes to the event bus and stores them in the appropriate stats table @@ -81,10 +83,33 @@ public class StatsHandler { /** * Registers StatsHandler with the event bus */ - public StatsHandler() { + public StatsHandler() throws Exception { + loadEventValidTypes(); EventBus.getInstance().register(this); } + /** + * Loads the stats configuration to determine the events to track. + * + * TODO: Update ConfigLoader to be instance and have file time checking to + * know if config needs to be reloaded. + * + * @throws Exception + */ + protected void loadEventValidTypes() throws Exception { + ConfigLoader configLoader = new ConfigLoader(); + configLoader.load(); + HashSet myValidEventTypes = new HashSet(); + + for (StatisticsConfig config : configLoader.getConfigurations()) { + for (StatisticsEvent event : config.getEvents()) { + myValidEventTypes.add(event.getType()); + } + } + + validEventTypes = Collections.unmodifiableSet(myValidEventTypes); + } + @Subscribe @AllowConcurrentEvents public void eventListener(Event event) {