Merge "Issue #1350: Fix ingestGrib and ingestDat posting of stats" into development
Former-commit-id:5a5b7274ba
[formerlyfb3a4b154b
] [formerly5a5b7274ba
[formerlyfb3a4b154b
] [formerly0dc908bc45
[formerly 46c26b2b58b0bf9d59e0005d537f82ccf3f0acbd]]] Former-commit-id:0dc908bc45
Former-commit-id:45a173ddc9
[formerly442c2778fa
] Former-commit-id:66f8cfe826
This commit is contained in:
commit
c1ed2217e0
7 changed files with 36 additions and 32 deletions
|
@ -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<DecimalFormat> FORMAT = new ThreadLocal<DecimalFormat>() {
|
||||
|
||||
@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.
|
||||
|
|
|
@ -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">
|
||||
|
||||
<bean id="eventBusThreadCount" class="java.lang.String">
|
||||
<constructor-arg type="java.lang.String" value="15" />
|
||||
</bean>
|
||||
|
||||
<bean id="logHandler" class="com.raytheon.uf.edex.event.handler.LogHandler"/>
|
||||
|
||||
</beans>
|
|
@ -0,0 +1,2 @@
|
|||
# Number of threads for async event bus
|
||||
eventBusThreadCount=15
|
|
@ -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",
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.raytheon.uf.edex.registry.feature</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.FeatureBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.FeatureNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -16,6 +16,5 @@
|
|||
</bean>
|
||||
|
||||
<bean id="statsHandler"
|
||||
class="com.raytheon.uf.edex.stats.handler.StatsHandler"
|
||||
depends-on="eventBusThreadCount"/>
|
||||
class="com.raytheon.uf.edex.stats.handler.StatsHandler"/>
|
||||
</beans>
|
||||
|
|
|
@ -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<String> myValidEventTypes = new HashSet<String>();
|
||||
|
||||
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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue