Issue #2280 Fix plugin purging

Former-commit-id: 12aa32056e70d27aee62935ed7057812bd8107ef
This commit is contained in:
Dave Hladky 2013-08-20 16:18:23 -05:00
parent 6f1e633d57
commit 4a10a699a9
4 changed files with 11 additions and 108 deletions

View file

@ -335,7 +335,7 @@
<include>.*-ogc-request.xml</include>
<!-- Purge OGC/DPA registred plugins -->
<include>purge-spring.xml</include>
<include>ogc-purge.xml</include>
<include>purge-spring-impl.xml</include>
<include>purge-logs.xml</include>
</mode>
<!-- This is MADIS implmentation of dataprovideragent -->

View file

@ -1,14 +0,0 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="purgeManager" class="com.raytheon.uf.edex.dataprovideragent.purge.OGCPurgeManager">
<property name="clusterLimit" value="${purge.clusterlimit}"/>
<property name="serverLimit" value="${purge.serverlimit}"/>
<property name="deadPurgeJobAge" value="${purge.deadjobage}"/>
<property name="purgeFrequency" value="${purge.frequency}"/>
<property name="fatalFailureCount" value="${purge.fatalfailurecount}"/>
<property name="purgeEnabled" value="${purge.enabled}"/>
</bean>
</beans>

View file

@ -1,67 +0,0 @@
package com.raytheon.uf.edex.dataprovideragent.purge;
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.edex.core.dataplugin.PluginRegistry;
import com.raytheon.uf.edex.purgesrv.PurgeManager;
/*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 11, 2013 #1959 dhladky Our own OGC purger
*
* </pre>
*
* @author dhladky
* @version 1.0
*/
public class OGCPurgeManager extends PurgeManager {
/**
* Creates a new PurgeManager
*/
protected OGCPurgeManager() {
}
/**
* Executes the purge only on available plugins that are registered with
* camel. This works better for the DPA instances that will be running it.
* They aren't required to purge data from plugins that aren't registerd to
* their JVM which would be highly wasteful in this instance.
*/
public void executePurge() {
// check for any new plugins or database being purged and needing
// entries recreated
List<String> availablePlugins = new ArrayList<String>(PluginRegistry
.getInstance().getRegisteredObjects());
purgeRunner(availablePlugins);
}
}

View file

@ -22,13 +22,10 @@ package com.raytheon.uf.edex.purgesrv;
import java.lang.Thread.State;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
@ -84,6 +81,8 @@ import com.raytheon.uf.edex.purgesrv.PurgeJob.PURGE_JOB_TYPE;
* ------------ ---------- ----------- --------------------------
* Apr 18, 2012 #470 bphillip Initial creation
* Apr 11, 2013 #1959 dhladky Added method that only processes running plugins
* Aug 18, 2013 #2280 dhladky Made OGC method of only purging active plugins the standard practice
*
*
* </pre>
*
@ -151,32 +150,17 @@ public class PurgeManager {
}
/**
* Executes the purge routine
* Executes the purge only on available plugins that are registered with
* camel. This works better for our system instances that will be running it.
* They aren't required to purge data from plugins that aren't registerd to
* their JVM which would be highly wasteful in this instance.
*/
public void executePurge() {
// Gets the list of plugins in ascending order by the last time they
// were purged
List<String> pluginList = dao.getPluginsByPurgeTime();
// check for any new plugins or database being purged and needing
// entries recreated
Set<String> availablePlugins = new HashSet<String>(PluginRegistry
// check only for active plugins
List<String> availablePlugins = new ArrayList<String>(PluginRegistry
.getInstance().getRegisteredObjects());
// Merge the lists
availablePlugins.removeAll(pluginList);
if (availablePlugins.size() > 0) {
// generate new list with them at the beginning
List<String> newSortedPlugins = new ArrayList<String>(
availablePlugins);
Collections.sort(newSortedPlugins);
newSortedPlugins.addAll(pluginList);
pluginList = newSortedPlugins;
}
purgeRunner(pluginList);
purgeRunner(availablePlugins);
}
/**