2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 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 package org.onap.aai.sparky.viewinspect.sync;
23 import static java.util.concurrent.CompletableFuture.supplyAsync;
25 import java.io.IOException;
26 import java.util.ArrayList;
27 import java.util.Collection;
28 import java.util.Deque;
29 import java.util.Iterator;
30 import java.util.List;
32 import java.util.concurrent.ConcurrentHashMap;
33 import java.util.concurrent.ConcurrentLinkedDeque;
34 import java.util.concurrent.ExecutorService;
35 import java.util.function.Supplier;
37 import org.onap.aai.cl.api.Logger;
38 import org.onap.aai.cl.eelf.LoggerFactory;
39 import org.onap.aai.cl.mdc.MdcContext;
40 import org.onap.aai.restclient.client.OperationResult;
41 import org.onap.aai.sparky.config.oxm.OxmEntityDescriptor;
42 import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
43 import org.onap.aai.sparky.config.oxm.SearchableEntityLookup;
44 import org.onap.aai.sparky.config.oxm.SearchableOxmEntityDescriptor;
45 import org.onap.aai.sparky.dal.ActiveInventoryAdapter;
46 import org.onap.aai.sparky.dal.NetworkTransaction;
47 import org.onap.aai.sparky.dal.rest.HttpMethod;
48 import org.onap.aai.sparky.logging.AaiUiMsgs;
49 import org.onap.aai.sparky.sync.AbstractEntitySynchronizer;
50 import org.onap.aai.sparky.sync.IndexSynchronizer;
51 import org.onap.aai.sparky.sync.SynchronizerConstants;
52 import org.onap.aai.sparky.sync.config.ElasticSearchSchemaConfig;
53 import org.onap.aai.sparky.sync.config.NetworkStatisticsConfig;
54 import org.onap.aai.sparky.sync.entity.MergableEntity;
55 import org.onap.aai.sparky.sync.entity.SearchableEntity;
56 import org.onap.aai.sparky.sync.entity.SelfLinkDescriptor;
57 import org.onap.aai.sparky.sync.enumeration.OperationState;
58 import org.onap.aai.sparky.sync.enumeration.SynchronizerState;
59 import org.onap.aai.sparky.sync.task.PerformActiveInventoryRetrieval;
60 import org.onap.aai.sparky.sync.task.PerformElasticSearchPut;
61 import org.onap.aai.sparky.sync.task.PerformElasticSearchRetrieval;
62 import org.onap.aai.sparky.sync.task.PerformElasticSearchUpdate;
63 import org.onap.aai.sparky.util.NodeUtils;
66 import com.fasterxml.jackson.core.JsonProcessingException;
67 import com.fasterxml.jackson.databind.JsonNode;
68 import com.fasterxml.jackson.databind.ObjectReader;
69 import com.fasterxml.jackson.databind.node.ArrayNode;
72 * The Class SearchableEntitySynchronizer.
74 public class ViewInspectEntitySynchronizer extends AbstractEntitySynchronizer
75 implements IndexSynchronizer {
78 * The Class RetrySearchableEntitySyncContainer.
80 private class RetrySearchableEntitySyncContainer {
81 NetworkTransaction txn;
85 * Instantiates a new retry searchable entity sync container.
90 public RetrySearchableEntitySyncContainer(NetworkTransaction txn, SearchableEntity se) {
95 public NetworkTransaction getNetworkTransaction() {
99 public SearchableEntity getSearchableEntity() {
104 private static final Logger LOG =
105 LoggerFactory.getInstance().getLogger(ViewInspectEntitySynchronizer.class);
107 private boolean allWorkEnumerated;
108 private Deque<SelfLinkDescriptor> selflinks;
109 private Deque<RetrySearchableEntitySyncContainer> retryQueue;
110 private Map<String, Integer> retryLimitTracker;
111 protected ExecutorService esPutExecutor;
112 private OxmEntityLookup oxmEntityLookup;
113 private SearchableEntityLookup searchableEntityLookup;
116 * Instantiates a new searchable entity synchronizer.
118 * @throws Exception the exception
120 public ViewInspectEntitySynchronizer(ElasticSearchSchemaConfig schemaConfig,
121 int internalSyncWorkers, int aaiWorkers, int esWorkers, NetworkStatisticsConfig aaiStatConfig,
122 NetworkStatisticsConfig esStatConfig, OxmEntityLookup oxmEntityLookup,
123 SearchableEntityLookup searchableEntityLookup) throws Exception {
124 super(LOG, "SES", internalSyncWorkers, aaiWorkers, esWorkers, schemaConfig.getIndexName(),
125 aaiStatConfig, esStatConfig);
127 this.oxmEntityLookup = oxmEntityLookup;
128 this.searchableEntityLookup = searchableEntityLookup;
129 this.allWorkEnumerated = false;
130 this.selflinks = new ConcurrentLinkedDeque<SelfLinkDescriptor>();
131 this.retryQueue = new ConcurrentLinkedDeque<RetrySearchableEntitySyncContainer>();
132 this.retryLimitTracker = new ConcurrentHashMap<String, Integer>();
133 this.synchronizerName = "Searchable Entity Synchronizer";
134 this.esPutExecutor = NodeUtils.createNamedExecutor("SES-ES-PUT", 5, LOG);
135 this.aaiEntityStats.intializeEntityCounters(
136 searchableEntityLookup.getSearchableEntityDescriptors().keySet());
137 this.esEntityStats.intializeEntityCounters(
138 searchableEntityLookup.getSearchableEntityDescriptors().keySet());
139 this.syncDurationInMs = -1;
143 * Collect all the work.
145 * @return the operation state
147 private OperationState collectAllTheWork() {
148 final Map<String, String> contextMap = MDC.getCopyOfContextMap();
149 Map<String, SearchableOxmEntityDescriptor> descriptorMap =
150 searchableEntityLookup.getSearchableEntityDescriptors();
152 if (descriptorMap.isEmpty()) {
153 LOG.error(AaiUiMsgs.ERROR_LOADING_OXM_SEARCHABLE_ENTITIES);
154 LOG.info(AaiUiMsgs.ERROR_LOADING_OXM_SEARCHABLE_ENTITIES);
155 return OperationState.ERROR;
158 Collection<String> syncTypes = descriptorMap.keySet();
160 /*Collection<String> syncTypes = new ArrayList<String>();
161 syncTypes.add("service-instance");*/
166 * launch a parallel async thread to process the documents for each entity-type (to max the
167 * of the configured executor anyway)
170 aaiWorkOnHand.set(syncTypes.size());
172 for (String key : syncTypes) {
174 supplyAsync(new Supplier<Void>() {
178 MDC.setContextMap(contextMap);
179 OperationResult typeLinksResult = null;
181 typeLinksResult = aaiAdapter.getSelfLinksByEntityType(key);
182 System.out.println(typeLinksResult);
183 aaiWorkOnHand.decrementAndGet();
184 processEntityTypeSelfLinks(typeLinksResult);
185 } catch (Exception exc) {
186 // TODO -> LOG, what should be logged here?
192 }, aaiExecutor).whenComplete((result, error) -> {
195 LOG.error(AaiUiMsgs.ERROR_GENERIC,
196 "An error occurred getting data from AAI. Error = " + error.getMessage());
202 while (aaiWorkOnHand.get() != 0) {
204 if (LOG.isDebugEnabled()) {
205 LOG.debug(AaiUiMsgs.WAIT_FOR_ALL_SELFLINKS_TO_BE_COLLECTED);
211 aaiWorkOnHand.set(selflinks.size());
212 allWorkEnumerated = true;
215 while (!isSyncDone()) {
221 * Make sure we don't hang on to retries that failed which could cause issues during future
224 retryLimitTracker.clear();
226 } catch (Exception exc) {
227 // TODO -> LOG, waht should be logged here?
230 return OperationState.OK;
234 * @see org.openecomp.sparky.synchronizer.IndexSynchronizer#doSync()
237 public OperationState doSync() {
238 this.syncDurationInMs = -1;
239 String txnID = NodeUtils.getRandomTxnId();
240 MdcContext.initialize(txnID, "SearchableEntitySynchronizer", "", "Sync", "");
243 this.allWorkEnumerated = false;
244 syncStartedTimeStampInMs = System.currentTimeMillis();
247 return OperationState.OK;
251 * Process entity type self links.
253 * @param operationResult the operation result
255 private void processEntityTypeSelfLinks(OperationResult operationResult) {
257 final String jsonResult = operationResult.getResult();
259 if (jsonResult != null && jsonResult.length() > 0 && operationResult.wasSuccessful()) {
262 JsonNode rootNode = mapper.readTree(jsonResult);
263 JsonNode resultData = rootNode.get("result-data");
265 if (resultData.isArray()) {
266 ArrayNode resultDataArrayNode = (ArrayNode) resultData;
268 Iterator<JsonNode> elementIterator = resultDataArrayNode.elements();
270 while (elementIterator.hasNext()) {
271 JsonNode element = elementIterator.next();
273 final String resourceType = NodeUtils.getNodeFieldAsText(element, "resource-type");
274 final String resourceLink = NodeUtils.getNodeFieldAsText(element, "resource-link");
276 SearchableOxmEntityDescriptor descriptor = null;
278 if (resourceType != null && resourceLink != null) {
280 descriptor = searchableEntityLookup.getSearchableEntityDescriptors().get(resourceType);
282 if (descriptor == null) {
283 LOG.error(AaiUiMsgs.MISSING_ENTITY_DESCRIPTOR, resourceType);
284 // go to next element in iterator
288 if (descriptor.hasSearchableAttributes()) {
289 selflinks.add(new SelfLinkDescriptor(resourceLink, SynchronizerConstants.NODES_ONLY_MODIFIER, resourceType));
295 } catch (IOException exc) {
297 "Could not deserialize JSON (representing operation result) as node tree. " +
298 "Operation result = " + jsonResult + ". " + exc.getLocalizedMessage();
299 LOG.error(AaiUiMsgs.JSON_PROCESSING_ERROR, message);
308 private void syncEntityTypes() {
310 while (selflinks.peek() != null) {
312 SelfLinkDescriptor linkDescriptor = selflinks.poll();
313 aaiWorkOnHand.decrementAndGet();
315 OxmEntityDescriptor descriptor = null;
317 if (linkDescriptor.getSelfLink() != null && linkDescriptor.getEntityType() != null) {
319 descriptor = oxmEntityLookup.getEntityDescriptors().get(linkDescriptor.getEntityType());
321 if (descriptor == null) {
322 LOG.error(AaiUiMsgs.MISSING_ENTITY_DESCRIPTOR, linkDescriptor.getEntityType());
323 // go to next element in iterator
327 NetworkTransaction txn = new NetworkTransaction();
328 txn.setDescriptor(descriptor);
329 txn.setLink(linkDescriptor.getSelfLink());
330 txn.setOperationType(HttpMethod.GET);
331 txn.setEntityType(linkDescriptor.getEntityType());
333 aaiWorkOnHand.incrementAndGet();
335 supplyAsync(new PerformActiveInventoryRetrieval(txn, aaiAdapter), aaiExecutor)
336 .whenComplete((result, error) -> {
338 aaiWorkOnHand.decrementAndGet();
341 LOG.error(AaiUiMsgs.AAI_RETRIEVAL_FAILED_GENERIC, error.getLocalizedMessage());
343 if (result == null) {
344 LOG.error(AaiUiMsgs.AAI_RETRIEVAL_FAILED_FOR_SELF_LINK,
345 linkDescriptor.getSelfLink());
347 updateActiveInventoryCounters(result);
348 fetchDocumentForUpsert(result);
359 * Perform document upsert.
361 * @param esGetTxn the es get txn
364 protected void performDocumentUpsert(NetworkTransaction esGetTxn, SearchableEntity se) {
368 * As part of the response processing we need to do the following:
369 * <li>1. Extract the version (if present), it will be the ETAG when we use the
370 * Search-Abstraction-Service
371 * <li>2. Spawn next task which is to do the PUT operation into elastic with or with the version
373 * <li>a) if version is null or RC=404, then standard put, no _update with version tag
374 * <li>b) if version != null, do PUT with _update?version= versionNumber in the URI to elastic
380 link = elasticSearchAdapter.buildElasticSearchGetDocUrl(getIndexName(), se.getId());
381 } catch (Exception exc) {
382 LOG.error(AaiUiMsgs.ES_LINK_UPSERT, exc.getLocalizedMessage());
386 String versionNumber = null;
387 boolean wasEntryDiscovered = false;
388 if (esGetTxn.getOperationResult().getResultCode() == 404) {
389 LOG.info(AaiUiMsgs.ES_SIMPLE_PUT, se.getEntityPrimaryKeyValue());
390 } else if (esGetTxn.getOperationResult().getResultCode() == 200) {
391 wasEntryDiscovered = true;
393 versionNumber = NodeUtils.extractFieldValueFromObject(
394 NodeUtils.convertJsonStrToJsonNode(esGetTxn.getOperationResult().getResult()),
396 } catch (IOException exc) {
398 "Error extracting version number from response, aborting searchable entity sync of "
399 + se.getEntityPrimaryKeyValue() + ". Error - " + exc.getLocalizedMessage();
400 LOG.error(AaiUiMsgs.ERROR_EXTRACTING_FROM_RESPONSE, message);
405 * Not being a 200 does not mean a failure. eg 201 is returned for created. TODO -> Should we
408 LOG.error(AaiUiMsgs.ES_OPERATION_RETURN_CODE,
409 String.valueOf(esGetTxn.getOperationResult().getResultCode()));
414 String jsonPayload = null;
415 if (wasEntryDiscovered) {
417 ArrayList<JsonNode> sourceObject = new ArrayList<JsonNode>();
418 NodeUtils.extractObjectsByKey(
419 NodeUtils.convertJsonStrToJsonNode(esGetTxn.getOperationResult().getResult()),
420 "_source", sourceObject);
422 if (!sourceObject.isEmpty()) {
423 String responseSource = NodeUtils.convertObjectToJson(sourceObject.get(0), false);
424 MergableEntity me = mapper.readValue(responseSource, MergableEntity.class);
425 ObjectReader updater = mapper.readerForUpdating(me);
426 MergableEntity merged = updater.readValue(NodeUtils.convertObjectToJson(se,false));
427 jsonPayload = mapper.writeValueAsString(merged);
429 } catch (IOException exc) {
431 "Error extracting source value from response, aborting searchable entity sync of "
432 + se.getEntityPrimaryKeyValue() + ". Error - " + exc.getLocalizedMessage();
433 LOG.error(AaiUiMsgs.ERROR_EXTRACTING_FROM_RESPONSE, message);
437 jsonPayload = se.getAsJson();
440 if (wasEntryDiscovered) {
441 if (versionNumber != null && jsonPayload != null) {
443 String requestPayload = elasticSearchAdapter.buildBulkImportOperationRequest(getIndexName(),
444 "default", se.getId(), versionNumber, jsonPayload);
446 NetworkTransaction transactionTracker = new NetworkTransaction();
447 transactionTracker.setEntityType(esGetTxn.getEntityType());
448 transactionTracker.setDescriptor(esGetTxn.getDescriptor());
449 transactionTracker.setOperationType(HttpMethod.PUT);
451 esWorkOnHand.incrementAndGet();
452 supplyAsync(new PerformElasticSearchUpdate(elasticSearchAdapter.getBulkUrl(),
453 requestPayload, elasticSearchAdapter, transactionTracker), esPutExecutor)
454 .whenComplete((result, error) -> {
456 esWorkOnHand.decrementAndGet();
459 String message = "Searchable entity sync UPDATE PUT error - "
460 + error.getLocalizedMessage();
461 LOG.error(AaiUiMsgs.ES_SEARCHABLE_ENTITY_SYNC_ERROR, message);
463 updateElasticSearchCounters(result);
464 processStoreDocumentResult(result, esGetTxn, se);
471 if (link != null && jsonPayload != null) {
473 NetworkTransaction updateElasticTxn = new NetworkTransaction();
474 updateElasticTxn.setLink(link);
475 updateElasticTxn.setEntityType(esGetTxn.getEntityType());
476 updateElasticTxn.setDescriptor(esGetTxn.getDescriptor());
477 updateElasticTxn.setOperationType(HttpMethod.PUT);
479 esWorkOnHand.incrementAndGet();
480 supplyAsync(new PerformElasticSearchPut(jsonPayload, updateElasticTxn, elasticSearchAdapter),
481 esPutExecutor).whenComplete((result, error) -> {
483 esWorkOnHand.decrementAndGet();
487 "Searchable entity sync UPDATE PUT error - " + error.getLocalizedMessage();
488 LOG.error(AaiUiMsgs.ES_SEARCHABLE_ENTITY_SYNC_ERROR, message);
490 updateElasticSearchCounters(result);
491 processStoreDocumentResult(result, esGetTxn, se);
496 } catch (Exception exc) {
497 String message = "Exception caught during searchable entity sync PUT operation. Message - "
498 + exc.getLocalizedMessage();
499 LOG.error(AaiUiMsgs.ES_SEARCHABLE_ENTITY_SYNC_ERROR, message);
504 * Populate searchable entity document.
507 * @param result the result
508 * @param resultDescriptor the result descriptor
509 * @throws JsonProcessingException the json processing exception
510 * @throws IOException Signals that an I/O exception has occurred.
512 protected void populateSearchableEntityDocument(SearchableEntity doc, String result,
513 OxmEntityDescriptor resultDescriptor) throws JsonProcessingException, IOException {
515 doc.setEntityType(resultDescriptor.getEntityName());
517 JsonNode entityNode = mapper.readTree(result);
519 List<String> primaryKeyValues = new ArrayList<String>();
520 String pkeyValue = null;
522 SearchableOxmEntityDescriptor searchableDescriptor = searchableEntityLookup.getSearchableEntityDescriptors().get(resultDescriptor.getEntityName());
524 for (String keyName : searchableDescriptor.getPrimaryKeyAttributeNames()) {
525 pkeyValue = NodeUtils.getNodeFieldAsText(entityNode, keyName);
526 if (pkeyValue != null) {
527 primaryKeyValues.add(pkeyValue);
529 String message = "populateSearchableEntityDocument(), pKeyValue is null for entityType = "
530 + resultDescriptor.getEntityName();
531 LOG.warn(AaiUiMsgs.WARN_GENERIC, message);
535 final String primaryCompositeKeyValue = NodeUtils.concatArray(primaryKeyValues, "/");
536 doc.setEntityPrimaryKeyValue(primaryCompositeKeyValue);
538 final List<String> searchTagFields = searchableDescriptor.getSearchableAttributes();
541 * Based on configuration, use the configured field names for this entity-Type to build a
542 * multi-value collection of search tags for elastic search entity search criteria.
544 for (String searchTagField : searchTagFields) {
545 String searchTagValue = NodeUtils.getNodeFieldAsText(entityNode, searchTagField);
546 if (searchTagValue != null && !searchTagValue.isEmpty()) {
547 doc.addSearchTagWithKey(searchTagValue, searchTagField);
553 * Fetch document for upsert.
557 private void fetchDocumentForUpsert(NetworkTransaction txn) {
558 if (!txn.getOperationResult().wasSuccessful()) {
559 String message = "Self link failure. Result - " + txn.getOperationResult().getResult();
560 LOG.error(AaiUiMsgs.ERROR_GENERIC, message);
564 SearchableOxmEntityDescriptor searchableDescriptor = searchableEntityLookup
565 .getSearchableEntityDescriptors().get(txn.getDescriptor().getEntityName());
568 if (searchableDescriptor.hasSearchableAttributes()) {
570 final String jsonResult = txn.getOperationResult().getResult();
571 if (jsonResult != null && jsonResult.length() > 0) {
573 SearchableEntity se = new SearchableEntity();
574 se.setLink(ActiveInventoryAdapter.extractResourcePath(txn.getLink()));
575 populateSearchableEntityDocument(se, jsonResult, txn.getDescriptor());
580 link = elasticSearchAdapter.buildElasticSearchGetDocUrl(getIndexName(), se.getId());
581 } catch (Exception exc) {
582 LOG.error(AaiUiMsgs.ES_FAILED_TO_CONSTRUCT_QUERY, exc.getLocalizedMessage());
586 NetworkTransaction n2 = new NetworkTransaction();
588 n2.setEntityType(txn.getEntityType());
589 n2.setDescriptor(txn.getDescriptor());
590 n2.setOperationType(HttpMethod.GET);
592 esWorkOnHand.incrementAndGet();
594 supplyAsync(new PerformElasticSearchRetrieval(n2, elasticSearchAdapter), esExecutor)
595 .whenComplete((result, error) -> {
597 esWorkOnHand.decrementAndGet();
600 LOG.error(AaiUiMsgs.ES_RETRIEVAL_FAILED, error.getLocalizedMessage());
602 updateElasticSearchCounters(result);
603 performDocumentUpsert(result, se);
610 } catch (JsonProcessingException exc) {
611 // TODO -> LOG, waht should be logged here?
612 } catch (IOException exc) {
613 // TODO -> LOG, waht should be logged here?
618 * Process store document result.
620 * @param esPutResult the es put result
621 * @param esGetResult the es get result
624 private void processStoreDocumentResult(NetworkTransaction esPutResult,
625 NetworkTransaction esGetResult, SearchableEntity se) {
627 OperationResult or = esPutResult.getOperationResult();
629 if (!or.wasSuccessful()) {
630 if (or.getResultCode() == VERSION_CONFLICT_EXCEPTION_CODE) {
632 if (shouldAllowRetry(se.getId())) {
633 esWorkOnHand.incrementAndGet();
635 RetrySearchableEntitySyncContainer rsc =
636 new RetrySearchableEntitySyncContainer(esGetResult, se);
637 retryQueue.push(rsc);
639 String message = "Store document failed during searchable entity synchronization"
640 + " due to version conflict. Entity will be re-synced.";
641 LOG.warn(AaiUiMsgs.ES_SEARCHABLE_ENTITY_SYNC_ERROR, message);
645 "Store document failed during searchable entity synchronization with result code "
646 + or.getResultCode() + " and result message " + or.getResult();
647 LOG.error(AaiUiMsgs.ES_SEARCHABLE_ENTITY_SYNC_ERROR, message);
653 * Perform retry sync.
655 private void performRetrySync() {
656 while (retryQueue.peek() != null) {
658 RetrySearchableEntitySyncContainer rsc = retryQueue.poll();
661 SearchableEntity se = rsc.getSearchableEntity();
662 NetworkTransaction txn = rsc.getNetworkTransaction();
667 * In this retry flow the se object has already derived its fields
669 link = elasticSearchAdapter.buildElasticSearchGetDocUrl(getIndexName(), se.getId());
670 } catch (Exception exc) {
671 LOG.error(AaiUiMsgs.ES_FAILED_TO_CONSTRUCT_URI, exc.getLocalizedMessage());
675 NetworkTransaction retryTransaction = new NetworkTransaction();
676 retryTransaction.setLink(link);
677 retryTransaction.setEntityType(txn.getEntityType());
678 retryTransaction.setDescriptor(txn.getDescriptor());
679 retryTransaction.setOperationType(HttpMethod.GET);
682 * IMPORTANT - DO NOT incrementAndGet the esWorkOnHand as this is a retry flow! We already
683 * called incrementAndGet when queuing the failed PUT!
686 supplyAsync(new PerformElasticSearchRetrieval(retryTransaction, elasticSearchAdapter),
687 esExecutor).whenComplete((result, error) -> {
689 esWorkOnHand.decrementAndGet();
692 LOG.error(AaiUiMsgs.ES_RETRIEVAL_FAILED_RESYNC, error.getLocalizedMessage());
694 updateElasticSearchCounters(result);
695 performDocumentUpsert(result, se);
705 * Should allow retry.
708 * @return true, if successful
710 private boolean shouldAllowRetry(String id) {
711 boolean isRetryAllowed = true;
712 if (retryLimitTracker.get(id) != null) {
713 Integer currentCount = retryLimitTracker.get(id);
714 if (currentCount.intValue() >= RETRY_COUNT_PER_ENTITY_LIMIT.intValue()) {
715 isRetryAllowed = false;
716 String message = "Searchable entity re-sync limit reached for " + id
717 + ", re-sync will no longer be attempted for this entity";
718 LOG.error(AaiUiMsgs.ES_SEARCHABLE_ENTITY_SYNC_ERROR, message);
720 Integer newCount = new Integer(currentCount.intValue() + 1);
721 retryLimitTracker.put(id, newCount);
724 Integer firstRetryCount = new Integer(1);
725 retryLimitTracker.put(id, firstRetryCount);
728 return isRetryAllowed;
732 public SynchronizerState getState() {
734 return SynchronizerState.PERFORMING_SYNCHRONIZATION;
737 return SynchronizerState.IDLE;
742 * @see org.openecomp.sparky.synchronizer.IndexSynchronizer#getStatReport(boolean)
745 public String getStatReport(boolean showFinalReport) {
746 syncDurationInMs = System.currentTimeMillis() - syncStartedTimeStampInMs;
747 return this.getStatReport(syncDurationInMs, showFinalReport);
751 * @see org.openecomp.sparky.synchronizer.IndexSynchronizer#shutdown()
754 public void shutdown() {
755 this.shutdownExecutors();
759 protected boolean isSyncDone() {
760 int totalWorkOnHand = aaiWorkOnHand.get() + esWorkOnHand.get();
762 if (totalWorkOnHand > 0 || !allWorkEnumerated) {