Issue #1782 - restore FFPMGenerator.java

Former-commit-id: 813033f4a2b30a669646b288eb00959922f0e804
This commit is contained in:
Steve Harris 2013-03-28 16:06:54 -05:00
parent a308b27c2f
commit 3953f8368b

View file

@ -32,6 +32,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.regex.Pattern;
import com.raytheon.edex.msg.DataURINotificationMessage;
import com.raytheon.edex.plugin.radar.dao.RadarStationDao;
import com.raytheon.edex.urifilter.URIFilter;
import com.raytheon.edex.urifilter.URIGenerateMessage;
@ -47,7 +48,6 @@ import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates.MODE;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils;
import com.raytheon.uf.common.dataplugin.ffmp.SourceBinList;
import com.raytheon.uf.common.dataplugin.ffmp.dao.FFMPDao;
import com.raytheon.uf.common.dataplugin.message.DataURINotificationMessage;
import com.raytheon.uf.common.dataplugin.radar.RadarStation;
import com.raytheon.uf.common.dataplugin.radar.util.RadarsInUseUtil;
import com.raytheon.uf.common.datastorage.DataStoreFactory;
@ -58,7 +58,6 @@ import com.raytheon.uf.common.datastorage.StorageProperties;
import com.raytheon.uf.common.datastorage.StorageProperties.Compression;
import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.event.EventBus;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
@ -83,7 +82,6 @@ import com.raytheon.uf.common.monitor.xml.SourceIngestConfigXML;
import com.raytheon.uf.common.monitor.xml.SourceXML;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.stats.ProcessEvent;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -120,9 +118,7 @@ import com.raytheon.uf.edex.plugin.ffmp.common.FFTIRatioDiff;
* 01/27/13 1478 D. Hladky Added creation of full cache records to help read write stress on NAS
* 02/01/13 1569 D. Hladky Added constants, switched to using aggregate records written through pypies
* 02/20/13 1635 D. Hladky Added some finally methods to increase dead lock safety. Reduced wait times for threads.
* Feb 15, 2013 1638 mschenke Moved DataURINotificationMessage to uf.common.dataplugin
* 02/25/13 1660 D. Hladky Redesigned data flow for FFTI in order to have only one mosaic piece in memory at a time.
* 03/22/13 1803 D. Hladky Fixed broken performance logging for ffmp.
* </pre>
*
* @author dhladky
@ -734,6 +730,10 @@ public class FFMPGenerator extends CompositeProductGenerator implements
}
}
}
}
SourceXML source = getSourceConfig().getSource(
ffmpRec.getSourceName());
if (!source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
@ -741,14 +741,11 @@ public class FFMPGenerator extends CompositeProductGenerator implements
dataKey, ffmpRec);
ffmpData.remove(sourceSiteDataKey);
statusHandler.info("Removing from memory: "+sourceSiteDataKey);
}
} // ffmp.isFFTI
} // record not null
} // end sitekey for loop
} // end datakey loop
} // end process
}
}
}
}
}
/**
@ -2017,42 +2014,31 @@ public class FFMPGenerator extends CompositeProductGenerator implements
}
/**
* Log process statistics
* Find siteSourceDataKey
*
* @param message
* @param source
* @param dataKey
* @param ffmpRec
* @return
*/
@Override
public void log(URIGenerateMessage message) {
private String getSourceSiteDataKey(SourceXML source, String dataKey, FFMPRecord ffmpRec) {
long curTime = System.currentTimeMillis();
ProcessEvent processEvent = new ProcessEvent();
String sourceName = source.getSourceName();
String sourceSiteDataKey = null;
if (productType != null) {
processEvent.setDataType(productType);
if (source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
sourceName = source.getDisplayName();
sourceSiteDataKey = sourceName;
} else {
sourceName = ffmpRec.getSourceName();
sourceSiteDataKey = sourceName + "-" + ffmpRec.getSiteKey()
+ "-" + dataKey;
}
Long dequeueTime = message.getDeQueuedTime();
if (dequeueTime != null) {
long elapsedMilliseconds = curTime - dequeueTime;
processEvent.setProcessingTime(elapsedMilliseconds);
return sourceSiteDataKey;
}
Long enqueueTime = message.getEnQueuedTime();
if (enqueueTime != null) {
long latencyMilliseconds = curTime - enqueueTime;
processEvent.setProcessingLatency(latencyMilliseconds);
}
// processing in less than 0 millis isn't trackable, usually due to
// an
// error occurred and statement logged incorrectly
if ((processEvent.getProcessingLatency() > 0)
&& (processEvent.getProcessingTime() > 0)) {
EventBus.publish(processEvent);
}
}
}