2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.onap.aai.sparky.autosuggestion.sync;
25 import static java.util.concurrent.CompletableFuture.supplyAsync;
27 import java.io.IOException;
28 import java.util.ArrayList;
29 import java.util.Arrays;
30 import java.util.Collection;
31 import java.util.Deque;
32 import java.util.EnumSet;
33 import java.util.HashMap;
34 import java.util.Iterator;
35 import java.util.List;
37 import java.util.concurrent.ConcurrentHashMap;
38 import java.util.concurrent.ConcurrentLinkedDeque;
39 import java.util.concurrent.ExecutorService;
40 import java.util.concurrent.atomic.AtomicInteger;
41 import java.util.function.Supplier;
43 import org.onap.aai.cl.api.Logger;
44 import org.onap.aai.cl.eelf.LoggerFactory;
45 import org.onap.aai.cl.mdc.MdcContext;
46 import org.onap.aai.restclient.client.OperationResult;
47 import org.onap.aai.sparky.config.oxm.OxmEntityDescriptor;
48 import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
49 import org.onap.aai.sparky.config.oxm.SuggestionEntityDescriptor;
50 import org.onap.aai.sparky.config.oxm.SuggestionEntityLookup;
51 import org.onap.aai.sparky.dal.ActiveInventoryAdapter;
52 import org.onap.aai.sparky.dal.NetworkTransaction;
53 import org.onap.aai.sparky.dal.rest.HttpMethod;
54 import org.onap.aai.sparky.logging.AaiUiMsgs;
55 import org.onap.aai.sparky.search.filters.config.FiltersConfig;
56 import org.onap.aai.sparky.sync.AbstractEntitySynchronizer;
57 import org.onap.aai.sparky.sync.IndexSynchronizer;
58 import org.onap.aai.sparky.sync.SynchronizerConstants;
59 import org.onap.aai.sparky.sync.config.ElasticSearchSchemaConfig;
60 import org.onap.aai.sparky.sync.config.NetworkStatisticsConfig;
61 import org.onap.aai.sparky.sync.entity.SelfLinkDescriptor;
62 import org.onap.aai.sparky.sync.entity.SuggestionSearchEntity;
63 import org.onap.aai.sparky.sync.enumeration.OperationState;
64 import org.onap.aai.sparky.sync.enumeration.SynchronizerState;
65 import org.onap.aai.sparky.sync.task.PerformActiveInventoryRetrieval;
66 import org.onap.aai.sparky.sync.task.PerformElasticSearchPut;
67 import org.onap.aai.sparky.sync.task.PerformElasticSearchRetrieval;
68 import org.onap.aai.sparky.util.NodeUtils;
69 import org.onap.aai.sparky.util.SuggestionsPermutation;
72 import com.fasterxml.jackson.core.JsonProcessingException;
73 import com.fasterxml.jackson.databind.JsonNode;
74 import com.fasterxml.jackson.databind.node.ArrayNode;
77 * The Class AutosuggestionSynchronizer.
79 public class AutosuggestionSynchronizer extends AbstractEntitySynchronizer
80 implements IndexSynchronizer {
82 private class RetrySuggestionEntitySyncContainer {
83 NetworkTransaction txn;
84 SuggestionSearchEntity ssec;
87 * Instantiates a new RetrySuggestionEntitySyncContainer.
90 * @param icer the icer
92 public RetrySuggestionEntitySyncContainer(NetworkTransaction txn, SuggestionSearchEntity icer) {
97 public NetworkTransaction getNetworkTransaction() {
101 public SuggestionSearchEntity getSuggestionSearchEntity() {
106 private static final Logger LOG =
107 LoggerFactory.getInstance().getLogger(AutosuggestionSynchronizer.class);
108 private static final String INSERTION_DATE_TIME_FORMAT = "yyyyMMdd'T'HHmmssZ";
110 private boolean allWorkEnumerated;
111 private Deque<SelfLinkDescriptor> selflinks;
112 private ConcurrentHashMap<String, AtomicInteger> entityCounters;
113 private boolean syncInProgress;
114 private Map<String, String> contextMap;
115 protected ExecutorService esPutExecutor;
116 private Deque<RetrySuggestionEntitySyncContainer> retryQueue;
117 private Map<String, Integer> retryLimitTracker;
118 private OxmEntityLookup oxmEntityLookup;
119 private SuggestionEntityLookup suggestionEntityLookup;
120 private FiltersConfig filtersConfig;
123 * Instantiates a new historical entity summarizer.
125 * @param indexName the index name
126 * @throws Exception the exception
128 public AutosuggestionSynchronizer(ElasticSearchSchemaConfig schemaConfig, int internalSyncWorkers,
129 int aaiWorkers, int esWorkers, NetworkStatisticsConfig aaiStatConfig,
130 NetworkStatisticsConfig esStatConfig, OxmEntityLookup oxmEntityLookup,
131 SuggestionEntityLookup suggestionEntityLookup, FiltersConfig filtersConfig) throws Exception {
133 super(LOG, "ASES-" + schemaConfig.getIndexName().toUpperCase(), internalSyncWorkers, aaiWorkers,
134 esWorkers, schemaConfig.getIndexName(), aaiStatConfig, esStatConfig);
136 this.oxmEntityLookup = oxmEntityLookup;
137 this.suggestionEntityLookup = suggestionEntityLookup;
138 this.allWorkEnumerated = false;
139 this.selflinks = new ConcurrentLinkedDeque<SelfLinkDescriptor>();
140 this.entityCounters = new ConcurrentHashMap<String, AtomicInteger>();
141 this.synchronizerName = "Autosuggestion Entity Synchronizer";
142 this.enabledStatFlags = EnumSet.of(StatFlag.AAI_REST_STATS, StatFlag.ES_REST_STATS);
143 this.syncInProgress = false;
144 this.contextMap = MDC.getCopyOfContextMap();
145 this.esPutExecutor = NodeUtils.createNamedExecutor("SUES-ES-PUT", 5, LOG);
146 this.retryQueue = new ConcurrentLinkedDeque<RetrySuggestionEntitySyncContainer>();
147 this.retryLimitTracker = new ConcurrentHashMap<String, Integer>();
148 this.syncDurationInMs = -1;
149 this.filtersConfig = filtersConfig;
153 * Collect all the work.
155 * @return the operation state
157 private OperationState collectAllTheWork() {
158 final Map<String, String> contextMap = MDC.getCopyOfContextMap();
159 Map<String, SuggestionEntityDescriptor> descriptorMap =
160 suggestionEntityLookup.getSuggestionSearchEntityDescriptors();
162 if (descriptorMap.isEmpty()) {
163 LOG.error(AaiUiMsgs.ERROR_LOADING_OXM_SUGGESTIBLE_ENTITIES);
164 LOG.info(AaiUiMsgs.ERROR_LOADING_OXM_SUGGESTIBLE_ENTITIES);
165 return OperationState.ERROR;
168 Collection<String> syncTypes = descriptorMap.keySet();
173 * launch a parallel async thread to process the documents for each entity-type (to max the of
174 * the configured executor anyway)
177 aaiWorkOnHand.set(syncTypes.size());
179 for (String key : syncTypes) {
181 supplyAsync(new Supplier<Void>() {
185 MDC.setContextMap(contextMap);
186 OperationResult typeLinksResult = null;
188 typeLinksResult = aaiAdapter.getSelfLinksByEntityType(key);
189 aaiWorkOnHand.decrementAndGet();
190 processEntityTypeSelfLinks(typeLinksResult);
191 } catch (Exception exc) {
192 LOG.error(AaiUiMsgs.ERROR_GENERIC,
193 "An error occurred while processing entity self-links. Error: "
200 }, aaiExecutor).whenComplete((result, error) -> {
203 LOG.error(AaiUiMsgs.ERROR_GENERIC,
204 "An error occurred getting data from AAI. Error = " + error.getMessage());
210 while (aaiWorkOnHand.get() != 0) {
212 if (LOG.isDebugEnabled()) {
213 LOG.debug(AaiUiMsgs.WAIT_FOR_ALL_SELFLINKS_TO_BE_COLLECTED);
219 aaiWorkOnHand.set(selflinks.size());
220 allWorkEnumerated = true;
223 while (!isSyncDone()) {
229 * Make sure we don't hang on to retries that failed which could cause issues during future
232 retryLimitTracker.clear();
234 } catch (Exception exc) {
235 LOG.error(AaiUiMsgs.ERROR_GENERIC,
236 "An error occurred while performing the sync. Error: " + exc.getMessage());
239 return OperationState.OK;
246 * @see org.openecomp.sparky.synchronizer.IndexSynchronizer#doSync()
249 public OperationState doSync() {
250 this.syncDurationInMs = -1;
251 syncStartedTimeStampInMs = System.currentTimeMillis();
252 String txnID = NodeUtils.getRandomTxnId();
253 MdcContext.initialize(txnID, "AutosuggestionSynchronizer", "", "Sync", "");
255 return collectAllTheWork();
259 * Process entity type self links.
261 * @param operationResult the operation result
263 private void processEntityTypeSelfLinks(OperationResult operationResult) {
265 JsonNode rootNode = null;
267 if ( operationResult == null ) {
271 final String jsonResult = operationResult.getResult();
273 if (jsonResult != null && jsonResult.length() > 0 && operationResult.wasSuccessful()) {
276 rootNode = mapper.readTree(jsonResult);
277 } catch (IOException exc) {
278 String message = "Could not deserialize JSON (representing operation result) as node tree. "
279 + "Operation result = " + jsonResult + ". " + exc.getLocalizedMessage();
280 LOG.error(AaiUiMsgs.JSON_PROCESSING_ERROR, message);
283 JsonNode resultData = rootNode.get("result-data");
284 ArrayNode resultDataArrayNode = null;
286 if (resultData.isArray()) {
287 resultDataArrayNode = (ArrayNode) resultData;
289 Iterator<JsonNode> elementIterator = resultDataArrayNode.elements();
290 JsonNode element = null;
292 while (elementIterator.hasNext()) {
293 element = elementIterator.next();
295 final String resourceType = NodeUtils.getNodeFieldAsText(element, "resource-type");
296 final String resourceLink = NodeUtils.getNodeFieldAsText(element, "resource-link");
298 OxmEntityDescriptor descriptor = null;
300 if (resourceType != null && resourceLink != null) {
302 descriptor = oxmEntityLookup.getEntityDescriptors().get(resourceType);
304 if (descriptor == null) {
305 LOG.error(AaiUiMsgs.MISSING_ENTITY_DESCRIPTOR, resourceType);
306 // go to next element in iterator
309 selflinks.add(new SelfLinkDescriptor(resourceLink,
310 SynchronizerConstants.NODES_ONLY_MODIFIER, resourceType));
322 private void syncEntityTypes() {
324 while (selflinks.peek() != null) {
326 SelfLinkDescriptor linkDescriptor = selflinks.poll();
327 aaiWorkOnHand.decrementAndGet();
329 OxmEntityDescriptor descriptor = null;
331 if (linkDescriptor.getSelfLink() != null && linkDescriptor.getEntityType() != null) {
333 descriptor = oxmEntityLookup.getEntityDescriptors().get(linkDescriptor.getEntityType());
335 if (descriptor == null) {
336 LOG.error(AaiUiMsgs.MISSING_ENTITY_DESCRIPTOR, linkDescriptor.getEntityType());
337 // go to next element in iterator
341 NetworkTransaction txn = new NetworkTransaction();
342 txn.setDescriptor(descriptor);
343 txn.setLink(linkDescriptor.getSelfLink());
344 txn.setOperationType(HttpMethod.GET);
345 txn.setEntityType(linkDescriptor.getEntityType());
347 aaiWorkOnHand.incrementAndGet();
349 supplyAsync(new PerformActiveInventoryRetrieval(txn, aaiAdapter), aaiExecutor)
350 .whenComplete((result, error) -> {
352 aaiWorkOnHand.decrementAndGet();
355 LOG.error(AaiUiMsgs.AAI_RETRIEVAL_FAILED_GENERIC, error.getLocalizedMessage());
357 if (result == null) {
358 LOG.error(AaiUiMsgs.AAI_RETRIEVAL_FAILED_FOR_SELF_LINK,
359 linkDescriptor.getSelfLink());
361 updateActiveInventoryCounters(result);
362 fetchDocumentForUpsert(result);
373 * Return a set of valid suggestion attributes for the provided entityName that are present in the
376 * @param node JSON node in which the attributes should be found
378 * @param entityName Name of the entity
380 * @return List of all valid suggestion attributes(key's)
382 public List<String> getSuggestableAttrNamesFromReponse(JsonNode node, String entityName) {
383 List<String> suggestableAttr = new ArrayList<String>();
385 HashMap<String, String> desc =
386 suggestionEntityLookup.getSuggestionSearchEntityOxmModel().get(entityName);
390 String attr = desc.get("suggestibleAttributes");
393 suggestableAttr = Arrays.asList(attr.split(","));
394 List<String> suggestableValue = new ArrayList<String>();
395 for (String attribute : suggestableAttr) {
396 if (node.get(attribute) != null && node.get(attribute).asText().length() > 0) {
397 suggestableValue.add(attribute);
400 return suggestableValue;
404 return new ArrayList<String>();
408 * Fetch all the documents for upsert. Based on the number of permutations that are available the
409 * number of documents will be different
413 private void fetchDocumentForUpsert(NetworkTransaction txn) {
414 if (!txn.getOperationResult().wasSuccessful()) {
415 String message = "Self link failure. Result - " + txn.getOperationResult().getResult();
416 LOG.error(AaiUiMsgs.ERROR_GENERIC, message);
420 final String jsonResult = txn.getOperationResult().getResult();
422 if (jsonResult != null && jsonResult.length() > 0) {
424 // Step 1: Calculate the number of possible permutations of attributes
425 String entityName = txn.getDescriptor().getEntityName();
426 JsonNode entityNode = mapper.readTree(jsonResult);
428 List<String> availableSuggestableAttrName =
429 getSuggestableAttrNamesFromReponse(entityNode, entityName);
431 ArrayList<ArrayList<String>> uniqueLists =
432 SuggestionsPermutation.getNonEmptyUniqueLists(availableSuggestableAttrName);
433 // Now we have a list of all possible permutations for the status that are
434 // defined for this entity type. Try inserting a document for every combination.
435 for (ArrayList<String> uniqueList : uniqueLists) {
437 SuggestionSearchEntity sse = new SuggestionSearchEntity(filtersConfig, suggestionEntityLookup);
438 sse.setSuggestableAttr(uniqueList);
439 sse.setFilterBasedPayloadFromResponse(entityNode, entityName, uniqueList);
440 sse.setLink(ActiveInventoryAdapter.extractResourcePath(txn.getLink()));
441 populateSuggestionSearchEntityDocument(sse, jsonResult, txn);
442 // The unique id for the document will be created at derive fields
444 // Insert the document only if it has valid statuses
445 if (sse.isSuggestableDoc()) {
448 link = elasticSearchAdapter.buildElasticSearchGetDocUrl(getIndexName(), sse.getId());
449 } catch (Exception exc) {
450 LOG.error(AaiUiMsgs.ES_FAILED_TO_CONSTRUCT_QUERY, exc.getLocalizedMessage());
454 NetworkTransaction n2 = new NetworkTransaction();
456 n2.setEntityType(txn.getEntityType());
457 n2.setDescriptor(txn.getDescriptor());
458 n2.setOperationType(HttpMethod.GET);
460 esWorkOnHand.incrementAndGet();
462 supplyAsync(new PerformElasticSearchRetrieval(n2, elasticSearchAdapter), esExecutor)
463 .whenComplete((result, error) -> {
465 esWorkOnHand.decrementAndGet();
468 LOG.error(AaiUiMsgs.ES_RETRIEVAL_FAILED, error.getLocalizedMessage());
470 updateElasticSearchCounters(result);
471 performDocumentUpsert(result, sse);
478 } catch (JsonProcessingException exc) {
479 LOG.error(AaiUiMsgs.ERROR_GENERIC, "There was a json processing error while processing the result from elasticsearch. Error: " + exc.getMessage());
480 } catch (IOException exc) {
481 LOG.error(AaiUiMsgs.ERROR_GENERIC, "There was a io processing error while processing the result from elasticsearch. Error: " + exc.getMessage());
485 protected void populateSuggestionSearchEntityDocument(SuggestionSearchEntity sse, String result,
486 NetworkTransaction txn) throws JsonProcessingException, IOException {
488 OxmEntityDescriptor resultDescriptor = txn.getDescriptor();
490 sse.setEntityType(resultDescriptor.getEntityName());
492 JsonNode entityNode = mapper.readTree(result);
494 List<String> primaryKeyValues = new ArrayList<String>();
495 String pkeyValue = null;
497 for (String keyName : resultDescriptor.getPrimaryKeyAttributeNames()) {
498 pkeyValue = NodeUtils.getNodeFieldAsText(entityNode, keyName);
499 if (pkeyValue != null) {
500 primaryKeyValues.add(pkeyValue);
502 String message = "populateSuggestionSearchEntityDocument(),"
503 + " pKeyValue is null for entityType = " + resultDescriptor.getEntityName();
504 LOG.warn(AaiUiMsgs.WARN_GENERIC, message);
508 final String primaryCompositeKeyValue = NodeUtils.concatArray(primaryKeyValues, "/");
509 sse.setEntityPrimaryKeyValue(primaryCompositeKeyValue);
510 sse.generateSuggestionInputPermutations();
513 protected void performDocumentUpsert(NetworkTransaction esGetTxn, SuggestionSearchEntity sse) {
517 * As part of the response processing we need to do the following:
518 * <li>1. Extract the version (if present), it will be the ETAG when we use the
519 * Search-Abstraction-Service
520 * <li>2. Spawn next task which is to do the PUT operation into elastic with or with the version
522 * <li>a) if version is null or RC=404, then standard put, no _update with version tag
523 * <li>b) if version != null, do PUT with _update?version= versionNumber in the URI to elastic
529 link = elasticSearchAdapter.buildElasticSearchGetDocUrl(getIndexName(), sse.getId());
530 } catch (Exception exc) {
531 LOG.error(AaiUiMsgs.ES_LINK_UPSERT, exc.getLocalizedMessage());
535 boolean wasEntryDiscovered = false;
536 if (esGetTxn.getOperationResult().getResultCode() == 404) {
537 LOG.info(AaiUiMsgs.ES_SIMPLE_PUT, sse.getEntityPrimaryKeyValue());
538 } else if (esGetTxn.getOperationResult().getResultCode() == 200) {
539 wasEntryDiscovered = true;
542 * Not being a 200 does not mean a failure. eg 201 is returned for created. and 500 for es not
543 * found TODO -> Should we return.
545 LOG.error(AaiUiMsgs.ES_OPERATION_RETURN_CODE,
546 String.valueOf(esGetTxn.getOperationResult().getResultCode()));
549 // Insert a new document only if the paylod is different.
550 // This is determined by hashing the payload and using it as a id for the document
552 if (!wasEntryDiscovered) {
554 String jsonPayload = null;
556 jsonPayload = sse.getAsJson();
557 if (link != null && jsonPayload != null) {
559 NetworkTransaction updateElasticTxn = new NetworkTransaction();
560 updateElasticTxn.setLink(link);
561 updateElasticTxn.setEntityType(esGetTxn.getEntityType());
562 updateElasticTxn.setDescriptor(esGetTxn.getDescriptor());
563 updateElasticTxn.setOperationType(HttpMethod.PUT);
565 esWorkOnHand.incrementAndGet();
566 supplyAsync(new PerformElasticSearchPut(jsonPayload, updateElasticTxn, elasticSearchAdapter),
567 esPutExecutor).whenComplete((result, error) -> {
569 esWorkOnHand.decrementAndGet();
572 String message = "Suggestion search entity sync UPDATE PUT error - "
573 + error.getLocalizedMessage();
574 LOG.error(AaiUiMsgs.ES_SUGGESTION_SEARCH_ENTITY_SYNC_ERROR, message);
576 updateElasticSearchCounters(result);
577 processStoreDocumentResult(result, esGetTxn, sse);
581 } catch (Exception exc) {
583 "Exception caught during suggestion search entity sync PUT operation. Message - "
584 + exc.getLocalizedMessage();
585 LOG.error(AaiUiMsgs.ES_SUGGESTION_SEARCH_ENTITY_SYNC_ERROR, message);
590 private void processStoreDocumentResult(NetworkTransaction esPutResult,
591 NetworkTransaction esGetResult, SuggestionSearchEntity sse) {
593 OperationResult or = esPutResult.getOperationResult();
595 if (!or.wasSuccessful()) {
596 if (or.getResultCode() == VERSION_CONFLICT_EXCEPTION_CODE) {
598 if (shouldAllowRetry(sse.getId())) {
599 esWorkOnHand.incrementAndGet();
601 RetrySuggestionEntitySyncContainer rssec =
602 new RetrySuggestionEntitySyncContainer(esGetResult, sse);
603 retryQueue.push(rssec);
605 String message = "Store document failed during suggestion search entity synchronization"
606 + " due to version conflict. Entity will be re-synced.";
607 LOG.warn(AaiUiMsgs.ES_SUGGESTION_SEARCH_ENTITY_SYNC_ERROR, message);
611 "Store document failed during suggestion search entity synchronization with result code "
612 + or.getResultCode() + " and result message " + or.getResult();
613 LOG.error(AaiUiMsgs.ES_SUGGESTION_SEARCH_ENTITY_SYNC_ERROR, message);
619 * Perform retry sync.
621 private void performRetrySync() {
622 while (retryQueue.peek() != null) {
624 RetrySuggestionEntitySyncContainer susc = retryQueue.poll();
627 SuggestionSearchEntity sus = susc.getSuggestionSearchEntity();
628 NetworkTransaction txn = susc.getNetworkTransaction();
633 * In this retry flow the se object has already derived its fields
635 link = elasticSearchAdapter.buildElasticSearchGetDocUrl(getIndexName(), sus.getId());
636 } catch (Exception exc) {
637 LOG.error(AaiUiMsgs.ES_FAILED_TO_CONSTRUCT_URI, exc.getLocalizedMessage());
641 NetworkTransaction retryTransaction = new NetworkTransaction();
642 retryTransaction.setLink(link);
643 retryTransaction.setEntityType(txn.getEntityType());
644 retryTransaction.setDescriptor(txn.getDescriptor());
645 retryTransaction.setOperationType(HttpMethod.GET);
648 * IMPORTANT - DO NOT incrementAndGet the esWorkOnHand as this is a retry flow! We already
649 * called incrementAndGet when queuing the failed PUT!
652 supplyAsync(new PerformElasticSearchRetrieval(retryTransaction, elasticSearchAdapter),
653 esExecutor).whenComplete((result, error) -> {
655 esWorkOnHand.decrementAndGet();
658 LOG.error(AaiUiMsgs.ES_RETRIEVAL_FAILED_RESYNC, error.getLocalizedMessage());
660 updateElasticSearchCounters(result);
661 performDocumentUpsert(result, sus);
671 * Should allow retry.
674 * @return true, if successful
676 private boolean shouldAllowRetry(String id) {
677 boolean isRetryAllowed = true;
678 if (retryLimitTracker.get(id) != null) {
679 Integer currentCount = retryLimitTracker.get(id);
680 if (currentCount.intValue() >= RETRY_COUNT_PER_ENTITY_LIMIT.intValue()) {
681 isRetryAllowed = false;
682 String message = "Searchable entity re-sync limit reached for " + id
683 + ", re-sync will no longer be attempted for this entity";
684 LOG.error(AaiUiMsgs.ES_SEARCHABLE_ENTITY_SYNC_ERROR, message);
686 Integer newCount = new Integer(currentCount.intValue() + 1);
687 retryLimitTracker.put(id, newCount);
690 Integer firstRetryCount = new Integer(1);
691 retryLimitTracker.put(id, firstRetryCount);
694 return isRetryAllowed;
700 public SynchronizerState getState() {
703 return SynchronizerState.PERFORMING_SYNCHRONIZATION;
706 return SynchronizerState.IDLE;
713 * @see org.openecomp.sparky.synchronizer.IndexSynchronizer#getStatReport(boolean)
716 public String getStatReport(boolean showFinalReport) {
717 syncDurationInMs = System.currentTimeMillis() - syncStartedTimeStampInMs;
718 return getStatReport(syncDurationInMs, showFinalReport);
724 * @see org.openecomp.sparky.synchronizer.IndexSynchronizer#shutdown()
727 public void shutdown() {
728 this.shutdownExecutors();
732 protected boolean isSyncDone() {
734 int totalWorkOnHand = aaiWorkOnHand.get() + esWorkOnHand.get();
736 if (LOG.isDebugEnabled()) {
737 LOG.debug(AaiUiMsgs.DEBUG_GENERIC, indexName + ", isSyncDone(), totalWorkOnHand = "
738 + totalWorkOnHand + " all work enumerated = " + allWorkEnumerated);
741 if (totalWorkOnHand > 0 || !allWorkEnumerated) {
745 this.syncInProgress = false;
753 * @see org.openecomp.sparky.synchronizer.AbstractEntitySynchronizer#clearCache()
756 public void clearCache() {
758 if (syncInProgress) {
759 LOG.debug(AaiUiMsgs.DEBUG_GENERIC,
760 "Autosuggestion Entity Summarizer in progress, request to clear cache ignored");
765 this.resetCounters();
766 if (entityCounters != null) {
767 entityCounters.clear();
770 allWorkEnumerated = false;