use of com.att.aro.core.bestpractice.IBestPractice in project VideoOptimzer by attdevsupport.
the class AROServiceImpl method analyze.
/**
* Performs BestPractice tests identified in the requests
* List<BestPracticeType> requests.<br>
* Test results are added to a resultList, ArrayList<IBestPractice>
*
* @param result
* a PacketAnalyzerResult object
* @param requests
* a List of BestPracticeType
* @return ArrayList<IBestPractice> or null if result was null
*/
@Override
public List<AbstractBestPracticeResult> analyze(PacketAnalyzerResult result, List<BestPracticeType> requests) {
if (result == null) {
return null;
}
List<AbstractBestPracticeResult> resultlist = new ArrayList<AbstractBestPracticeResult>();
IBestPractice worker = null;
if (requests.contains(BestPracticeType.USING_CACHE) || requests.contains(BestPracticeType.CACHE_CONTROL) || requests.contains(BestPracticeType.DUPLICATE_CONTENT)) {
this.createCacheAnalysis(result);
}
for (BestPracticeType type : requests) {
worker = getBPWorker(type);
if (worker != null) {
try {
long bpStartTime = System.currentTimeMillis();
resultlist.add(worker.runTest(result));
GoogleAnalyticsUtil.getGoogleAnalyticsInstance().sendAnalyticsTimings(type.getDescription(), System.currentTimeMillis() - bpStartTime, bpTimingsTitle);
} catch (Exception | Error ex) {
LOGGER.error("Error running best practice " + type.getDescription() + " : ", ex);
new Thread(() -> sendExceptiontoGA(type)).start();
}
}
}
for (AbstractBestPracticeResult testresult : resultlist) {
sendGABPResult(testresult);
}
return resultlist;
}
Aggregations