* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.sparky.sync;
import org.onap.aai.sparky.dal.aai.ActiveInventoryEntityStatistics;
import org.onap.aai.sparky.dal.aai.ActiveInventoryProcessingExceptionStatistics;
import org.onap.aai.sparky.dal.elasticsearch.ElasticSearchEntityStatistics;
-import org.onap.aai.sparky.dal.elasticsearch.config.ElasticSearchConfig;
import org.onap.aai.sparky.dal.rest.HttpMethod;
import org.onap.aai.sparky.dal.rest.RestOperationalStatistics;
import org.onap.aai.sparky.logging.AaiUiMsgs;
* The Enum StatFlag.
*/
protected enum StatFlag {
- AAI_REST_STATS, AAI_ENTITY_STATS, AAI_PROCESSING_EXCEPTION_STATS, AAI_TASK_PROCESSING_STATS, ES_REST_STATS, ES_ENTITY_STATS, ES_TASK_PROCESSING_STATS
+ AAI_REST_STATS, AAI_ENTITY_STATS, AAI_PROCESSING_EXCEPTION_STATS,
+ AAI_TASK_PROCESSING_STATS, ES_REST_STATS, ES_ENTITY_STATS, ES_TASK_PROCESSING_STATS
}
protected EnumSet<StatFlag> enabledStatFlags;
protected String synchronizerName;
protected abstract boolean isSyncDone();
-
protected boolean shouldSkipSync;
public String getActiveInventoryStatisticsReport() {
protected AbstractEntitySynchronizer(Logger logger, String syncName, int numSyncWorkers,
int numActiveInventoryWorkers, int numElasticsearchWorkers, String indexName,
NetworkStatisticsConfig aaiStatConfig, NetworkStatisticsConfig esStatConfig)
- throws Exception {
+ throws Exception {
this.logger = logger;
this.synchronizerExecutor =
NodeUtils.createNamedExecutor(syncName + "-INTERNAL", numSyncWorkers, logger);
this.esExecutor =
NodeUtils.createNamedExecutor(syncName + "-ES", numElasticsearchWorkers, logger);
this.mapper = new ObjectMapper();
- this.indexName = indexName;
+ this.indexName = indexName;
this.esRestStats = new RestOperationalStatistics();
this.esEntityStats = new ElasticSearchEntityStatistics();
this.aaiRestStats = new RestOperationalStatistics();
this.aaiEntityStats = new ActiveInventoryEntityStatistics();
this.aaiProcessingExceptionStats = new ActiveInventoryProcessingExceptionStatistics();
- this.aaiTaskProcessingStats = new TaskProcessingStats(aaiStatConfig);
- this.esTaskProcessingStats = new TaskProcessingStats(esStatConfig);
+ this.aaiTaskProcessingStats =
+ new TaskProcessingStats(aaiStatConfig);
+ this.esTaskProcessingStats =
+ new TaskProcessingStats(esStatConfig);
this.aaiTransactionRateController =
new TransactionRateMonitor(numActiveInventoryWorkers, aaiStatConfig);
enabledStatFlags = EnumSet.allOf(StatFlag.class);
this.synchronizerName = "Abstact Entity Synchronizer";
-
+
String txnID = NodeUtils.getRandomTxnId();
- MdcContext.initialize(txnID, "AbstractEntitySynchronizer", "", "Sync", "");
+ MdcContext.initialize(txnID, "AbstractEntitySynchronizer", "", "Sync", "");
this.shouldSkipSync = false;
this.syncStartedTimeStampInMs = System.currentTimeMillis();
if (esExecutor != null) {
esExecutor.shutdown();
}
-
+
} catch (Exception exc) {
- logger.error(AaiUiMsgs.ERROR_SHUTDOWN_EXECUTORS, exc);
+ logger.error(AaiUiMsgs.ERROR_SHUTDOWN_EXECUTORS, exc );
}
}
* Clear cache.
*/
public void clearCache() {}
-
+
public ElasticSearchAdapter getElasticSearchAdapter() {
return elasticSearchAdapter;
}
this.aaiAdapter = aaiAdapter;
}
- /**
- * Gets the elastic full url.
- *
- * @param resourceUrl the resource url
- * @param indexName the index name
- * @param indexType the index type
- * @return the elastic full url
- * @throws Exception the exception
- */
- protected String getElasticFullUrl(String resourceUrl, String indexName, String indexType)
- throws Exception {
- return ElasticSearchConfig.getConfig().getElasticFullUrl(resourceUrl, indexName, indexType);
- }
-
- /**
- * Gets the elastic full url.
- *
- * @param resourceUrl the resource url
- * @param indexName the index name
- * @return the elastic full url
- * @throws Exception the exception
- */
- protected String getElasticFullUrl(String resourceUrl, String indexName) throws Exception {
- return ElasticSearchConfig.getConfig().getElasticFullUrl(resourceUrl, indexName);
- }
-
public String getIndexName() {
return indexName;
}
return -1;
}
- /**
- * Update elastic search counters.
- *
- * @param method the method
- * @param or the or
- */
- protected void updateElasticSearchCounters(HttpMethod method, OperationResult or) {
- updateElasticSearchCounters(new NetworkTransaction(method, null, or));
- }
-
/**
* Update elastic search counters.
*
esTransactionRateController.trackResponseTime(txn.getOpTimeInMs());
- esTaskProcessingStats.updateTaskResponseStatsHistogram(txn.getOpTimeInMs());
+ esTaskProcessingStats
+ .updateTaskResponseStatsHistogram(txn.getOpTimeInMs());
esTaskProcessingStats.updateTaskAgeStatsHistogram(txn.getTaskAgeInMs());
// don't know the cost of the lengh calc, we'll see if it causes a
}
}
- /**
- * Update active inventory counters.
- *
- * @param method the method
- * @param or the or
- */
- protected void updateActiveInventoryCounters(HttpMethod method, OperationResult or) {
- updateActiveInventoryCounters(new NetworkTransaction(method, null, or));
- }
-
/**
* Update active inventory counters.
*
}
if (enabledStatFlags.contains(StatFlag.AAI_TASK_PROCESSING_STATS)) {
- aaiTransactionRateController.trackResponseTime(txn.getOpTimeInMs());
+ aaiTransactionRateController
+ .trackResponseTime(txn.getOpTimeInMs());
- aaiTaskProcessingStats.updateTaskResponseStatsHistogram(txn.getOpTimeInMs());
+ aaiTaskProcessingStats
+ .updateTaskResponseStatsHistogram(txn.getOpTimeInMs());
aaiTaskProcessingStats.updateTaskAgeStatsHistogram(txn.getTaskAgeInMs());
// don't know the cost of the lengh calc, we'll see if it causes a