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 * @param indexName the index name
119 * @throws Exception the exception
121 public ViewInspectEntitySynchronizer(ElasticSearchSchemaConfig schemaConfig,
122 int internalSyncWorkers, int aaiWorkers, int esWorkers, NetworkStatisticsConfig aaiStatConfig,
123 NetworkStatisticsConfig esStatConfig, OxmEntityLookup oxmEntityLookup,
124 SearchableEntityLookup searchableEntityLookup) throws Exception {
125 super(LOG, "SES", internalSyncWorkers, aaiWorkers, esWorkers, schemaConfig.getIndexName(),
126 aaiStatConfig, esStatConfig);
128 this.oxmEntityLookup = oxmEntityLookup;
129 this.searchableEntityLookup = searchableEntityLookup;
130 this.allWorkEnumerated = false;
131 this.selflinks = new ConcurrentLinkedDeque<SelfLinkDescriptor>();
132 this.retryQueue = new ConcurrentLinkedDeque<RetrySearchableEntitySyncContainer>();
133 this.retryLimitTracker = new ConcurrentHashMap<String, Integer>();
134 this.synchronizerName = "Searchable Entity Synchronizer";
135 this.esPutExecutor = NodeUtils.createNamedExecutor("SES-ES-PUT", 5, LOG);
136 this.aaiEntityStats.intializeEntityCounters(
137 searchableEntityLookup.getSearchableEntityDescriptors().keySet());
138 this.esEntityStats.intializeEntityCounters(
139 searchableEntityLookup.getSearchableEntityDescriptors().keySet());
140 this.syncDurationInMs = -1;
144 * Collect all the work.
146 * @return the operation state
148 private OperationState collectAllTheWork() {
149 final Map<String, String> contextMap = MDC.getCopyOfContextMap();
150 Map<String, SearchableOxmEntityDescriptor> descriptorMap =
151 searchableEntityLookup.getSearchableEntityDescriptors();
153 if (descriptorMap.isEmpty()) {
154 LOG.error(AaiUiMsgs.ERROR_LOADING_OXM_SEARCHABLE_ENTITIES);
155 LOG.info(AaiUiMsgs.ERROR_LOADING_OXM_SEARCHABLE_ENTITIES);
156 return OperationState.ERROR;
159 Collection<String> syncTypes = descriptorMap.keySet();
161 /*Collection<String> syncTypes = new ArrayList<String>();
162 syncTypes.add("service-instance");*/
167 * launch a parallel async thread to process the documents for each entity-type (to max the
168 * of the configured executor anyway)
171 aaiWorkOnHand.set(syncTypes.size());
173 for (String key : syncTypes) {
175 supplyAsync(new Supplier<Void>() {
179 MDC.setContextMap(contextMap);
180 OperationResult typeLinksResult = null;
182 typeLinksResult = aaiAdapter.getSelfLinksByEntityType(key);
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 JsonNode rootNode = null;
259 final String jsonResult = operationResult.getResult();
261 if (jsonResult != null && jsonResult.length() > 0 && operationResult.wasSuccessful()) {
264 rootNode = mapper.readTree(jsonResult);
265 } catch (IOException exc) {
267 "Could not deserialize JSON (representing operation result) as node tree. " +
268 "Operation result = " + jsonResult + ". " + exc.getLocalizedMessage();
269 LOG.error(AaiUiMsgs.JSON_PROCESSING_ERROR, message);
272 JsonNode resultData = rootNode.get("result-data");
273 ArrayNode resultDataArrayNode = null;
275 if (resultData.isArray()) {
276 resultDataArrayNode = (ArrayNode) resultData;
278 Iterator<JsonNode> elementIterator = resultDataArrayNode.elements();
279 JsonNode element = null;
281 while (elementIterator.hasNext()) {
282 element = elementIterator.next();
284 final String resourceType = NodeUtils.getNodeFieldAsText(element, "resource-type");
285 final String resourceLink = NodeUtils.getNodeFieldAsText(element, "resource-link");
287 SearchableOxmEntityDescriptor descriptor = null;
289 if (resourceType != null && resourceLink != null) {
291 descriptor = searchableEntityLookup.getSearchableEntityDescriptors().get(resourceType);
293 if (descriptor == null) {
294 LOG.error(AaiUiMsgs.MISSING_ENTITY_DESCRIPTOR, resourceType);
295 // go to next element in iterator
299 if (descriptor.hasSearchableAttributes()) {
300 selflinks.add(new SelfLinkDescriptor(resourceLink, SynchronizerConstants.NODES_ONLY_MODIFIER, resourceType));
313 private void syncEntityTypes() {
315 while (selflinks.peek() != null) {
317 SelfLinkDescriptor linkDescriptor = selflinks.poll();
318 aaiWorkOnHand.decrementAndGet();
320 OxmEntityDescriptor descriptor = null;
322 if (linkDescriptor.getSelfLink() != null && linkDescriptor.getEntityType() != null) {
324 descriptor = oxmEntityLookup.getEntityDescriptors().get(linkDescriptor.getEntityType());
326 if (descriptor == null) {
327 LOG.error(AaiUiMsgs.MISSING_ENTITY_DESCRIPTOR, linkDescriptor.getEntityType());
328 // go to next element in iterator
332 NetworkTransaction txn = new NetworkTransaction();
333 txn.setDescriptor(descriptor);
334 txn.setLink(linkDescriptor.getSelfLink());
335 txn.setOperationType(HttpMethod.GET);
336 txn.setEntityType(linkDescriptor.getEntityType());
338 aaiWorkOnHand.incrementAndGet();
340 supplyAsync(new PerformActiveInventoryRetrieval(txn, aaiAdapter), aaiExecutor)
341 .whenComplete((result, error) -> {
343 aaiWorkOnHand.decrementAndGet();
346 LOG.error(AaiUiMsgs.AAI_RETRIEVAL_FAILED_GENERIC, error.getLocalizedMessage());
348 if (result == null) {
349 LOG.error(AaiUiMsgs.AAI_RETRIEVAL_FAILED_FOR_SELF_LINK,
350 linkDescriptor.getSelfLink());
352 updateActiveInventoryCounters(result);
353 fetchDocumentForUpsert(result);
364 * Perform document upsert.
366 * @param esGetTxn the es get txn
369 protected void performDocumentUpsert(NetworkTransaction esGetTxn, SearchableEntity se) {
373 * As part of the response processing we need to do the following:
374 * <li>1. Extract the version (if present), it will be the ETAG when we use the
375 * Search-Abstraction-Service
376 * <li>2. Spawn next task which is to do the PUT operation into elastic with or with the version
378 * <li>a) if version is null or RC=404, then standard put, no _update with version tag
379 * <li>b) if version != null, do PUT with _update?version= versionNumber in the URI to elastic
385 link = elasticSearchAdapter.buildElasticSearchGetDocUrl(getIndexName(), se.getId());
386 } catch (Exception exc) {
387 LOG.error(AaiUiMsgs.ES_LINK_UPSERT, exc.getLocalizedMessage());
391 String versionNumber = null;
392 boolean wasEntryDiscovered = false;
393 if (esGetTxn.getOperationResult().getResultCode() == 404) {
394 LOG.info(AaiUiMsgs.ES_SIMPLE_PUT, se.getEntityPrimaryKeyValue());
395 } else if (esGetTxn.getOperationResult().getResultCode() == 200) {
396 wasEntryDiscovered = true;
398 versionNumber = NodeUtils.extractFieldValueFromObject(
399 NodeUtils.convertJsonStrToJsonNode(esGetTxn.getOperationResult().getResult()),
401 } catch (IOException exc) {
403 "Error extracting version number from response, aborting searchable entity sync of "
404 + se.getEntityPrimaryKeyValue() + ". Error - " + exc.getLocalizedMessage();
405 LOG.error(AaiUiMsgs.ERROR_EXTRACTING_FROM_RESPONSE, message);
410 * Not being a 200 does not mean a failure. eg 201 is returned for created. TODO -> Should we
413 LOG.error(AaiUiMsgs.ES_OPERATION_RETURN_CODE,
414 String.valueOf(esGetTxn.getOperationResult().getResultCode()));
419 String jsonPayload = null;
420 if (wasEntryDiscovered) {
422 ArrayList<JsonNode> sourceObject = new ArrayList<JsonNode>();
423 NodeUtils.extractObjectsByKey(
424 NodeUtils.convertJsonStrToJsonNode(esGetTxn.getOperationResult().getResult()),
425 "_source", sourceObject);
427 if (!sourceObject.isEmpty()) {
428 String responseSource = NodeUtils.convertObjectToJson(sourceObject.get(0), false);
429 MergableEntity me = mapper.readValue(responseSource, MergableEntity.class);
430 ObjectReader updater = mapper.readerForUpdating(me);
431 MergableEntity merged = updater.readValue(NodeUtils.convertObjectToJson(se,false));
432 jsonPayload = mapper.writeValueAsString(merged);
434 } catch (IOException exc) {
436 "Error extracting source value from response, aborting searchable entity sync of "
437 + se.getEntityPrimaryKeyValue() + ". Error - " + exc.getLocalizedMessage();
438 LOG.error(AaiUiMsgs.ERROR_EXTRACTING_FROM_RESPONSE, message);
442 jsonPayload = se.getAsJson();
445 if (wasEntryDiscovered) {
446 if (versionNumber != null && jsonPayload != null) {
448 String requestPayload = elasticSearchAdapter.buildBulkImportOperationRequest(getIndexName(),
449 "default", se.getId(), versionNumber, jsonPayload);
451 NetworkTransaction transactionTracker = new NetworkTransaction();
452 transactionTracker.setEntityType(esGetTxn.getEntityType());
453 transactionTracker.setDescriptor(esGetTxn.getDescriptor());
454 transactionTracker.setOperationType(HttpMethod.PUT);
456 esWorkOnHand.incrementAndGet();
457 supplyAsync(new PerformElasticSearchUpdate(elasticSearchAdapter.getBulkUrl(),
458 requestPayload, elasticSearchAdapter, transactionTracker), esPutExecutor)
459 .whenComplete((result, error) -> {
461 esWorkOnHand.decrementAndGet();
464 String message = "Searchable entity sync UPDATE PUT error - "
465 + error.getLocalizedMessage();
466 LOG.error(AaiUiMsgs.ES_SEARCHABLE_ENTITY_SYNC_ERROR, message);
468 updateElasticSearchCounters(result);
469 processStoreDocumentResult(result, esGetTxn, se);
476 if (link != null && jsonPayload != null) {
478 NetworkTransaction updateElasticTxn = new NetworkTransaction();
479 updateElasticTxn.setLink(link);
480 updateElasticTxn.setEntityType(esGetTxn.getEntityType());
481 updateElasticTxn.setDescriptor(esGetTxn.getDescriptor());
482 updateElasticTxn.setOperationType(HttpMethod.PUT);
484 esWorkOnHand.incrementAndGet();
485 supplyAsync(new PerformElasticSearchPut(jsonPayload, updateElasticTxn, elasticSearchAdapter),
486 esPutExecutor).whenComplete((result, error) -> {
488 esWorkOnHand.decrementAndGet();
492 "Searchable entity sync UPDATE PUT error - " + error.getLocalizedMessage();
493 LOG.error(AaiUiMsgs.ES_SEARCHABLE_ENTITY_SYNC_ERROR, message);
495 updateElasticSearchCounters(result);
496 processStoreDocumentResult(result, esGetTxn, se);
501 } catch (Exception exc) {
502 String message = "Exception caught during searchable entity sync PUT operation. Message - "
503 + exc.getLocalizedMessage();
504 LOG.error(AaiUiMsgs.ES_SEARCHABLE_ENTITY_SYNC_ERROR, message);
509 * Populate searchable entity document.
512 * @param result the result
513 * @param resultDescriptor the result descriptor
514 * @throws JsonProcessingException the json processing exception
515 * @throws IOException Signals that an I/O exception has occurred.
517 protected void populateSearchableEntityDocument(SearchableEntity doc, String result,
518 OxmEntityDescriptor resultDescriptor) throws JsonProcessingException, IOException {
520 doc.setEntityType(resultDescriptor.getEntityName());
522 JsonNode entityNode = mapper.readTree(result);
524 List<String> primaryKeyValues = new ArrayList<String>();
525 String pkeyValue = null;
527 SearchableOxmEntityDescriptor searchableDescriptor = searchableEntityLookup.getSearchableEntityDescriptors().get(resultDescriptor.getEntityName());
529 for (String keyName : searchableDescriptor.getPrimaryKeyAttributeNames()) {
530 pkeyValue = NodeUtils.getNodeFieldAsText(entityNode, keyName);
531 if (pkeyValue != null) {
532 primaryKeyValues.add(pkeyValue);
534 String message = "populateSearchableEntityDocument(), pKeyValue is null for entityType = "
535 + resultDescriptor.getEntityName();
536 LOG.warn(AaiUiMsgs.WARN_GENERIC, message);
540 final String primaryCompositeKeyValue = NodeUtils.concatArray(primaryKeyValues, "/");
541 doc.setEntityPrimaryKeyValue(primaryCompositeKeyValue);
543 final List<String> searchTagFields = searchableDescriptor.getSearchableAttributes();
546 * Based on configuration, use the configured field names for this entity-Type to build a
547 * multi-value collection of search tags for elastic search entity search criteria.
549 for (String searchTagField : searchTagFields) {
550 String searchTagValue = NodeUtils.getNodeFieldAsText(entityNode, searchTagField);
551 if (searchTagValue != null && !searchTagValue.isEmpty()) {
552 doc.addSearchTagWithKey(searchTagValue, searchTagField);
558 * Fetch document for upsert.
562 private void fetchDocumentForUpsert(NetworkTransaction txn) {
563 if (!txn.getOperationResult().wasSuccessful()) {
564 String message = "Self link failure. Result - " + txn.getOperationResult().getResult();
565 LOG.error(AaiUiMsgs.ERROR_GENERIC, message);
569 SearchableOxmEntityDescriptor searchableDescriptor = searchableEntityLookup
570 .getSearchableEntityDescriptors().get(txn.getDescriptor().getEntityName());
573 if (searchableDescriptor.hasSearchableAttributes()) {
575 final String jsonResult = txn.getOperationResult().getResult();
576 if (jsonResult != null && jsonResult.length() > 0) {
578 SearchableEntity se = new SearchableEntity();
579 se.setLink(ActiveInventoryAdapter.extractResourcePath(txn.getLink()));
580 populateSearchableEntityDocument(se, jsonResult, txn.getDescriptor());
585 link = elasticSearchAdapter.buildElasticSearchGetDocUrl(getIndexName(), se.getId());
586 } catch (Exception exc) {
587 LOG.error(AaiUiMsgs.ES_FAILED_TO_CONSTRUCT_QUERY, exc.getLocalizedMessage());
591 NetworkTransaction n2 = new NetworkTransaction();
593 n2.setEntityType(txn.getEntityType());
594 n2.setDescriptor(txn.getDescriptor());
595 n2.setOperationType(HttpMethod.GET);
597 esWorkOnHand.incrementAndGet();
599 supplyAsync(new PerformElasticSearchRetrieval(n2, elasticSearchAdapter), esExecutor)
600 .whenComplete((result, error) -> {
602 esWorkOnHand.decrementAndGet();
605 LOG.error(AaiUiMsgs.ES_RETRIEVAL_FAILED, error.getLocalizedMessage());
607 updateElasticSearchCounters(result);
608 performDocumentUpsert(result, se);
615 } catch (JsonProcessingException exc) {
616 // TODO -> LOG, waht should be logged here?
617 } catch (IOException exc) {
618 // TODO -> LOG, waht should be logged here?
623 * Process store document result.
625 * @param esPutResult the es put result
626 * @param esGetResult the es get result
629 private void processStoreDocumentResult(NetworkTransaction esPutResult,
630 NetworkTransaction esGetResult, SearchableEntity se) {
632 OperationResult or = esPutResult.getOperationResult();
634 if (!or.wasSuccessful()) {
635 if (or.getResultCode() == VERSION_CONFLICT_EXCEPTION_CODE) {
637 if (shouldAllowRetry(se.getId())) {
638 esWorkOnHand.incrementAndGet();
640 RetrySearchableEntitySyncContainer rsc =
641 new RetrySearchableEntitySyncContainer(esGetResult, se);
642 retryQueue.push(rsc);
644 String message = "Store document failed during searchable entity synchronization"
645 + " due to version conflict. Entity will be re-synced.";
646 LOG.warn(AaiUiMsgs.ES_SEARCHABLE_ENTITY_SYNC_ERROR, message);
650 "Store document failed during searchable entity synchronization with result code "
651 + or.getResultCode() + " and result message " + or.getResult();
652 LOG.error(AaiUiMsgs.ES_SEARCHABLE_ENTITY_SYNC_ERROR, message);
658 * Perform retry sync.
660 private void performRetrySync() {
661 while (retryQueue.peek() != null) {
663 RetrySearchableEntitySyncContainer rsc = retryQueue.poll();
666 SearchableEntity se = rsc.getSearchableEntity();
667 NetworkTransaction txn = rsc.getNetworkTransaction();
672 * In this retry flow the se object has already derived its fields
674 link = elasticSearchAdapter.buildElasticSearchGetDocUrl(getIndexName(), se.getId());
675 } catch (Exception exc) {
676 LOG.error(AaiUiMsgs.ES_FAILED_TO_CONSTRUCT_URI, exc.getLocalizedMessage());
680 NetworkTransaction retryTransaction = new NetworkTransaction();
681 retryTransaction.setLink(link);
682 retryTransaction.setEntityType(txn.getEntityType());
683 retryTransaction.setDescriptor(txn.getDescriptor());
684 retryTransaction.setOperationType(HttpMethod.GET);
687 * IMPORTANT - DO NOT incrementAndGet the esWorkOnHand as this is a retry flow! We already
688 * called incrementAndGet when queuing the failed PUT!
691 supplyAsync(new PerformElasticSearchRetrieval(retryTransaction, elasticSearchAdapter),
692 esExecutor).whenComplete((result, error) -> {
694 esWorkOnHand.decrementAndGet();
697 LOG.error(AaiUiMsgs.ES_RETRIEVAL_FAILED_RESYNC, error.getLocalizedMessage());
699 updateElasticSearchCounters(result);
700 performDocumentUpsert(result, se);
710 * Should allow retry.
713 * @return true, if successful
715 private boolean shouldAllowRetry(String id) {
716 boolean isRetryAllowed = true;
717 if (retryLimitTracker.get(id) != null) {
718 Integer currentCount = retryLimitTracker.get(id);
719 if (currentCount.intValue() >= RETRY_COUNT_PER_ENTITY_LIMIT.intValue()) {
720 isRetryAllowed = false;
721 String message = "Searchable entity re-sync limit reached for " + id
722 + ", re-sync will no longer be attempted for this entity";
723 LOG.error(AaiUiMsgs.ES_SEARCHABLE_ENTITY_SYNC_ERROR, message);
725 Integer newCount = new Integer(currentCount.intValue() + 1);
726 retryLimitTracker.put(id, newCount);
729 Integer firstRetryCount = new Integer(1);
730 retryLimitTracker.put(id, firstRetryCount);
733 return isRetryAllowed;
737 public SynchronizerState getState() {
739 return SynchronizerState.PERFORMING_SYNCHRONIZATION;
742 return SynchronizerState.IDLE;
747 * @see org.openecomp.sparky.synchronizer.IndexSynchronizer#getStatReport(boolean)
750 public String getStatReport(boolean showFinalReport) {
751 syncDurationInMs = System.currentTimeMillis() - syncStartedTimeStampInMs;
752 return this.getStatReport(syncDurationInMs, showFinalReport);
756 * @see org.openecomp.sparky.synchronizer.IndexSynchronizer#shutdown()
759 public void shutdown() {
760 this.shutdownExecutors();
764 protected boolean isSyncDone() {
765 int totalWorkOnHand = aaiWorkOnHand.get() + esWorkOnHand.get();
767 if (totalWorkOnHand > 0 || !allWorkEnumerated) {