Merge "Issue #1310: Tie D2DParmIdCache rebuilds to grid purge, not grib purge." into development

Former-commit-id: 52007a3a00 [formerly a13ecc678d2fb7bf0e58922e07e3b5df60a197f4]
Former-commit-id: 257213e491
This commit is contained in:
Ron Anderson 2012-11-05 17:33:06 -06:00 committed by Gerrit Code Review
commit 5edafa6c86
4 changed files with 30 additions and 20 deletions

View file

@ -83,5 +83,16 @@
<from uri="jms-generic:topic:rebuildD2DCache" />
<bean ref="d2dParmIdCache" method="buildCache" />
</route>
<route id="rebuildD2DCacheAfterPurge">
<from uri="jms-generic:topic:pluginPurged" />
<doTry>
<bean ref="d2dParmIdCache" method="pluginPurged" />
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:paramIdCache?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true"/>
</doCatch>
</doTry>
</route>
</camelContext>
</beans>

View file

@ -58,7 +58,9 @@ import com.raytheon.uf.edex.site.SiteAwareRegistry;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 1/08/09 1674 bphillip Initial creation
* 01/08/09 1674 bphillip Initial creation
* 11/05/12 #1310 dgilling Modify cache to listen to plugin
* purged topic.
* </pre>
*
* @author bphillip
@ -392,4 +394,11 @@ public class D2DParmIdCache {
}
return size;
}
public void pluginPurged(String pluginName)
throws GfeConfigurationException, PluginException {
if (pluginName.equals("grid")) {
buildCache(null);
}
}
}

View file

@ -79,6 +79,8 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* 4/7/09 1994 bphillip Initial Creation
* 5/31/12 #674 dgilling Re-factor so all purge methods
* call updateCaches().
* 11/05/12 #1310 dgilling Remove code from updateCatches()
* that sent notification to D2DParmIdCache.
*
* </pre>
*
@ -97,8 +99,6 @@ public class GribDao extends PluginDao {
private static final String THINNED_PTS = "thinnedPts";
private static final String REBUILD_CACHE_TOPIC = "jms-generic:topic:rebuildD2DCache";
private static final String PURGE_MODEL_CACHE_TOPIC = "jms-generic:topic:purgeGribModelCache";
/**
@ -149,32 +149,17 @@ public class GribDao extends PluginDao {
* @throws PluginException
*/
private void updateCaches() throws PluginException {
Exception rethrow = null;
try {
List<Integer> orphanedIds = purgeGribModelOrphans();
EDEXUtil.getMessageProducer().sendAsyncUri(PURGE_MODEL_CACHE_TOPIC,
orphanedIds);
} catch (DataAccessLayerException e) {
statusHandler.error("Error purging orphaned grib model entries", e);
rethrow = e;
throw new PluginException("Error updating GribModelCache", e);
} catch (EdexException e1) {
statusHandler.error(
"Error sending message to purge grib model topic", e1);
rethrow = e1;
}
try {
EDEXUtil.getMessageProducer().sendAsyncUri(REBUILD_CACHE_TOPIC,
null);
} catch (EdexException e) {
statusHandler.error(
"Error sending message to rebuild D2D Cache topic", e);
rethrow = e;
}
if (rethrow != null) {
throw new PluginException(
"Error updating GribModelCache or D2DParmIDCache", rethrow);
throw new PluginException("Error updating GribModelCache", e1);
}
}

View file

@ -26,6 +26,7 @@ import java.util.Map;
import com.raytheon.uf.common.dataplugin.grid.request.DeleteAllGridDataRequest;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.edex.core.EDEXUtil;
import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
/**
@ -48,6 +49,8 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
public class DeleteAllGridDataHandler implements
IRequestHandler<DeleteAllGridDataRequest> {
private static final String PLUGIN_PURGED_TOPIC = "jms-generic:topic:pluginPurged";
/*
* (non-Javadoc)
*
@ -67,6 +70,8 @@ public class DeleteAllGridDataHandler implements
recsDeleted += dao.purgeDataByRefTime(time, productKeys);
}
EDEXUtil.getMessageProducer().sendAsyncUri(PLUGIN_PURGED_TOPIC, "grid");
return recsDeleted;
}
}