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.aggregation.sync;
25 import static java.util.concurrent.CompletableFuture.supplyAsync;
27 import java.io.IOException;
28 import java.util.ArrayList;
29 import java.util.Deque;
30 import java.util.EnumSet;
31 import java.util.Iterator;
33 import java.util.concurrent.ConcurrentHashMap;
34 import java.util.concurrent.ConcurrentLinkedDeque;
35 import java.util.concurrent.ExecutorService;
36 import java.util.concurrent.atomic.AtomicInteger;
37 import java.util.function.Supplier;
39 import org.onap.aai.cl.api.Logger;
40 import org.onap.aai.cl.eelf.LoggerFactory;
41 import org.onap.aai.cl.mdc.MdcContext;
42 import org.onap.aai.restclient.client.OperationResult;
43 import org.onap.aai.sparky.config.oxm.OxmEntityDescriptor;
44 import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
45 import org.onap.aai.sparky.dal.NetworkTransaction;
46 import org.onap.aai.sparky.dal.aai.config.ActiveInventoryConfig;
47 import org.onap.aai.sparky.dal.elasticsearch.config.ElasticSearchConfig;
48 import org.onap.aai.sparky.dal.rest.HttpMethod;
49 import org.onap.aai.sparky.logging.AaiUiMsgs;
50 import org.onap.aai.sparky.sync.AbstractEntitySynchronizer;
51 import org.onap.aai.sparky.sync.IndexSynchronizer;
52 import org.onap.aai.sparky.sync.SynchronizerConstants;
53 import org.onap.aai.sparky.sync.config.ElasticSearchSchemaConfig;
54 import org.onap.aai.sparky.sync.config.NetworkStatisticsConfig;
55 import org.onap.aai.sparky.sync.entity.AggregationEntity;
56 import org.onap.aai.sparky.sync.entity.MergableEntity;
57 import org.onap.aai.sparky.sync.entity.SelfLinkDescriptor;
58 import org.onap.aai.sparky.sync.enumeration.OperationState;
59 import org.onap.aai.sparky.sync.enumeration.SynchronizerState;
60 import org.onap.aai.sparky.sync.task.PerformActiveInventoryRetrieval;
61 import org.onap.aai.sparky.sync.task.PerformElasticSearchPut;
62 import org.onap.aai.sparky.sync.task.PerformElasticSearchRetrieval;
63 import org.onap.aai.sparky.sync.task.PerformElasticSearchUpdate;
64 import org.onap.aai.sparky.util.NodeUtils;
67 import com.fasterxml.jackson.core.JsonProcessingException;
68 import com.fasterxml.jackson.databind.JsonNode;
69 import com.fasterxml.jackson.databind.ObjectReader;
70 import com.fasterxml.jackson.databind.node.ArrayNode;
73 * The Class AutosuggestionSynchronizer.
75 public class AggregationSynchronizer extends AbstractEntitySynchronizer
76 implements IndexSynchronizer {
79 * The Class RetryAggregationEntitySyncContainer.
81 private class RetryAggregationEntitySyncContainer {
82 NetworkTransaction txn;
86 * Instantiates a new retry aggregation entity sync container.
91 public RetryAggregationEntitySyncContainer(NetworkTransaction txn, AggregationEntity ae) {
96 public NetworkTransaction getNetworkTransaction() {
100 public AggregationEntity getAggregationEntity() {
105 private static final Logger LOG =
106 LoggerFactory.getInstance().getLogger(AggregationSynchronizer.class);
107 private static final String INSERTION_DATE_TIME_FORMAT = "yyyyMMdd'T'HHmmssZ";
109 private boolean allWorkEnumerated;
110 private Deque<SelfLinkDescriptor> selflinks;
111 private Deque<RetryAggregationEntitySyncContainer> retryQueue;
112 private Map<String, Integer> retryLimitTracker;
113 protected ExecutorService esPutExecutor;
114 private ConcurrentHashMap<String, AtomicInteger> entityCounters;
115 private boolean syncInProgress;
116 private Map<String, String> contextMap;
117 private String entityType;
118 private ElasticSearchSchemaConfig schemaConfig;
121 * Instantiates a new entity aggregation synchronizer.
123 * @param indexName the index name
124 * @throws Exception the exception
126 public AggregationSynchronizer(String entityType, ElasticSearchSchemaConfig schemaConfig,
127 int numSyncWorkers, int numActiveInventoryWorkers, int numElasticWorkers,
128 NetworkStatisticsConfig aaiStatConfig, NetworkStatisticsConfig esStatConfig)
131 super(LOG, "AGGES-" + schemaConfig.getIndexName().toUpperCase(), numSyncWorkers,
132 numActiveInventoryWorkers, numElasticWorkers, schemaConfig.getIndexName(), aaiStatConfig,
133 esStatConfig); // multiple
135 // Entity Synchronizer will
136 // run for different indices
138 this.schemaConfig = schemaConfig;
139 this.entityType = entityType;
140 this.allWorkEnumerated = false;
141 this.entityCounters = new ConcurrentHashMap<String, AtomicInteger>();
142 this.synchronizerName = "Entity Aggregation Synchronizer";
143 this.enabledStatFlags = EnumSet.of(StatFlag.AAI_REST_STATS, StatFlag.ES_REST_STATS);
144 this.syncInProgress = false;
145 this.allWorkEnumerated = false;
146 this.selflinks = new ConcurrentLinkedDeque<SelfLinkDescriptor>();
147 this.retryQueue = new ConcurrentLinkedDeque<RetryAggregationEntitySyncContainer>();
148 this.retryLimitTracker = new ConcurrentHashMap<String, Integer>();
150 this.esPutExecutor = NodeUtils.createNamedExecutor("AGGES-ES-PUT", 1, LOG);
152 this.aaiEntityStats.intializeEntityCounters(entityType);
153 this.esEntityStats.intializeEntityCounters(entityType);
155 this.contextMap = MDC.getCopyOfContextMap();
159 * Collect all the work.
161 * @return the operation state
163 private OperationState collectAllTheWork() {
164 final Map<String, String> contextMap = MDC.getCopyOfContextMap();
165 final String entity = this.getEntityType();
168 aaiWorkOnHand.set(1);
170 supplyAsync(new Supplier<Void>() {
174 MDC.setContextMap(contextMap);
175 OperationResult typeLinksResult = null;
177 typeLinksResult = aaiAdapter.getSelfLinksByEntityType(entity);
178 aaiWorkOnHand.decrementAndGet();
179 processEntityTypeSelfLinks(typeLinksResult);
180 } catch (Exception exc) {
181 // TODO -> LOG, what should be logged here?
183 exc.printStackTrace();
189 }, aaiExecutor).whenComplete((result, error) -> {
192 LOG.error(AaiUiMsgs.ERROR_GENERIC,
193 "An error occurred getting data from AAI. Error = " + error.getMessage());
197 while (aaiWorkOnHand.get() != 0) {
199 if (LOG.isDebugEnabled()) {
200 LOG.debug(AaiUiMsgs.WAIT_FOR_ALL_SELFLINKS_TO_BE_COLLECTED);
206 aaiWorkOnHand.set(selflinks.size());
207 allWorkEnumerated = true;
210 while (!isSyncDone()) {
216 * Make sure we don't hang on to retries that failed which could cause issues during future
219 retryLimitTracker.clear();
221 } catch (Exception exc) {
222 // TODO -> LOG, waht should be logged here?
225 return OperationState.OK;
230 * Perform retry sync.
232 private void performRetrySync() {
233 while (retryQueue.peek() != null) {
235 RetryAggregationEntitySyncContainer rsc = retryQueue.poll();
238 AggregationEntity ae = rsc.getAggregationEntity();
239 NetworkTransaction txn = rsc.getNetworkTransaction();
244 * In this retry flow the se object has already derived its fields
246 link = getElasticFullUrl("/" + ae.getId(), getIndexName());
247 } catch (Exception exc) {
248 LOG.error(AaiUiMsgs.ES_FAILED_TO_CONSTRUCT_URI, exc.getLocalizedMessage());
252 NetworkTransaction retryTransaction = new NetworkTransaction();
253 retryTransaction.setLink(link);
254 retryTransaction.setEntityType(txn.getEntityType());
255 retryTransaction.setDescriptor(txn.getDescriptor());
256 retryTransaction.setOperationType(HttpMethod.GET);
259 * IMPORTANT - DO NOT incrementAndGet the esWorkOnHand as this is a retry flow! We already
260 * called incrementAndGet when queuing the failed PUT!
263 supplyAsync(new PerformElasticSearchRetrieval(retryTransaction, elasticSearchAdapter),
264 esExecutor).whenComplete((result, error) -> {
266 esWorkOnHand.decrementAndGet();
269 LOG.error(AaiUiMsgs.ES_RETRIEVAL_FAILED_RESYNC, error.getLocalizedMessage());
271 updateElasticSearchCounters(result);
272 performDocumentUpsert(result, ae);
282 * Perform document upsert.
284 * @param esGetTxn the es get txn
287 protected void performDocumentUpsert(NetworkTransaction esGetTxn, AggregationEntity ae) {
291 * As part of the response processing we need to do the following:
292 * <li>1. Extract the version (if present), it will be the ETAG when we use the
293 * Search-Abstraction-Service
294 * <li>2. Spawn next task which is to do the PUT operation into elastic with or with the version
296 * <li>a) if version is null or RC=404, then standard put, no _update with version tag
297 * <li>b) if version != null, do PUT with _update?version= versionNumber in the URI to elastic
303 link = getElasticFullUrl("/" + ae.getId(), getIndexName());
304 } catch (Exception exc) {
305 LOG.error(AaiUiMsgs.ES_LINK_UPSERT, exc.getLocalizedMessage());
309 String versionNumber = null;
310 boolean wasEntryDiscovered = false;
311 if (esGetTxn.getOperationResult().getResultCode() == 404) {
312 LOG.info(AaiUiMsgs.ES_SIMPLE_PUT, ae.getEntityPrimaryKeyValue());
313 } else if (esGetTxn.getOperationResult().getResultCode() == 200) {
314 wasEntryDiscovered = true;
316 versionNumber = NodeUtils.extractFieldValueFromObject(
317 NodeUtils.convertJsonStrToJsonNode(esGetTxn.getOperationResult().getResult()),
319 } catch (IOException exc) {
321 "Error extracting version number from response, aborting aggregation entity sync of "
322 + ae.getEntityPrimaryKeyValue() + ". Error - " + exc.getLocalizedMessage();
323 LOG.error(AaiUiMsgs.ERROR_EXTRACTING_FROM_RESPONSE, message);
328 * Not being a 200 does not mean a failure. eg 201 is returned for created. TODO -> Should we
331 LOG.error(AaiUiMsgs.ES_OPERATION_RETURN_CODE,
332 String.valueOf(esGetTxn.getOperationResult().getResultCode()));
337 String jsonPayload = null;
338 if (wasEntryDiscovered) {
340 ArrayList<JsonNode> sourceObject = new ArrayList<JsonNode>();
341 NodeUtils.extractObjectsByKey(
342 NodeUtils.convertJsonStrToJsonNode(esGetTxn.getOperationResult().getResult()),
343 "_source", sourceObject);
345 if (!sourceObject.isEmpty()) {
346 String responseSource = NodeUtils.convertObjectToJson(sourceObject.get(0), false);
347 MergableEntity me = mapper.readValue(responseSource, MergableEntity.class);
348 ObjectReader updater = mapper.readerForUpdating(me);
349 MergableEntity merged = updater.readValue(ae.getAsJson());
350 jsonPayload = mapper.writeValueAsString(merged);
352 } catch (IOException exc) {
354 "Error extracting source value from response, aborting aggregation entity sync of "
355 + ae.getEntityPrimaryKeyValue() + ". Error - " + exc.getLocalizedMessage();
356 LOG.error(AaiUiMsgs.ERROR_EXTRACTING_FROM_RESPONSE, message);
360 jsonPayload = ae.getAsJson();
363 if (wasEntryDiscovered) {
364 if (versionNumber != null && jsonPayload != null) {
366 String requestPayload =
367 elasticSearchAdapter.buildBulkImportOperationRequest(schemaConfig.getIndexName(),
368 schemaConfig.getIndexDocType(), ae.getId(), versionNumber, jsonPayload);
370 NetworkTransaction transactionTracker = new NetworkTransaction();
371 transactionTracker.setEntityType(esGetTxn.getEntityType());
372 transactionTracker.setDescriptor(esGetTxn.getDescriptor());
373 transactionTracker.setOperationType(HttpMethod.PUT);
375 esWorkOnHand.incrementAndGet();
376 supplyAsync(new PerformElasticSearchUpdate(ElasticSearchConfig.getConfig().getBulkUrl(),
377 requestPayload, elasticSearchAdapter, transactionTracker), esPutExecutor)
378 .whenComplete((result, error) -> {
380 esWorkOnHand.decrementAndGet();
383 String message = "Aggregation entity sync UPDATE PUT error - "
384 + error.getLocalizedMessage();
385 LOG.error(AaiUiMsgs.ERROR_GENERIC, message);
387 updateElasticSearchCounters(result);
388 processStoreDocumentResult(result, esGetTxn, ae);
394 if (link != null && jsonPayload != null) {
396 NetworkTransaction updateElasticTxn = new NetworkTransaction();
397 updateElasticTxn.setLink(link);
398 updateElasticTxn.setEntityType(esGetTxn.getEntityType());
399 updateElasticTxn.setDescriptor(esGetTxn.getDescriptor());
400 updateElasticTxn.setOperationType(HttpMethod.PUT);
402 esWorkOnHand.incrementAndGet();
404 new PerformElasticSearchPut(jsonPayload, updateElasticTxn, elasticSearchAdapter),
405 esPutExecutor).whenComplete((result, error) -> {
407 esWorkOnHand.decrementAndGet();
411 "Aggregation entity sync UPDATE PUT error - " + error.getLocalizedMessage();
412 LOG.error(AaiUiMsgs.ERROR_GENERIC, message);
414 updateElasticSearchCounters(result);
415 processStoreDocumentResult(result, esGetTxn, ae);
420 } catch (Exception exc) {
421 String message = "Exception caught during aggregation entity sync PUT operation. Message - "
422 + exc.getLocalizedMessage();
423 LOG.error(AaiUiMsgs.ERROR_GENERIC, message);
428 * Should allow retry.
431 * @return true, if successful
433 private boolean shouldAllowRetry(String id) {
434 boolean isRetryAllowed = true;
435 if (retryLimitTracker.get(id) != null) {
436 Integer currentCount = retryLimitTracker.get(id);
437 if (currentCount.intValue() >= RETRY_COUNT_PER_ENTITY_LIMIT.intValue()) {
438 isRetryAllowed = false;
439 String message = "Aggregation entity re-sync limit reached for " + id
440 + ", re-sync will no longer be attempted for this entity";
441 LOG.error(AaiUiMsgs.ERROR_GENERIC, message);
443 Integer newCount = new Integer(currentCount.intValue() + 1);
444 retryLimitTracker.put(id, newCount);
447 Integer firstRetryCount = new Integer(1);
448 retryLimitTracker.put(id, firstRetryCount);
451 return isRetryAllowed;
455 * Process store document result.
457 * @param esPutResult the es put result
458 * @param esGetResult the es get result
461 private void processStoreDocumentResult(NetworkTransaction esPutResult,
462 NetworkTransaction esGetResult, AggregationEntity ae) {
464 OperationResult or = esPutResult.getOperationResult();
466 if (!or.wasSuccessful()) {
467 if (or.getResultCode() == VERSION_CONFLICT_EXCEPTION_CODE) {
469 if (shouldAllowRetry(ae.getId())) {
470 esWorkOnHand.incrementAndGet();
472 RetryAggregationEntitySyncContainer rsc =
473 new RetryAggregationEntitySyncContainer(esGetResult, ae);
474 retryQueue.push(rsc);
476 String message = "Store document failed during aggregation entity synchronization"
477 + " due to version conflict. Entity will be re-synced.";
478 LOG.warn(AaiUiMsgs.ERROR_GENERIC, message);
482 "Store document failed during aggregation entity synchronization with result code "
483 + or.getResultCode() + " and result message " + or.getResult();
484 LOG.error(AaiUiMsgs.ERROR_GENERIC, message);
492 private void syncEntityTypes() {
494 while (selflinks.peek() != null) {
496 SelfLinkDescriptor linkDescriptor = selflinks.poll();
497 aaiWorkOnHand.decrementAndGet();
499 OxmEntityDescriptor descriptor = null;
501 if (linkDescriptor.getSelfLink() != null && linkDescriptor.getEntityType() != null) {
503 descriptor = OxmEntityLookup.getInstance().getEntityDescriptors()
504 .get(linkDescriptor.getEntityType());
506 if (descriptor == null) {
507 LOG.error(AaiUiMsgs.MISSING_ENTITY_DESCRIPTOR, linkDescriptor.getEntityType());
508 // go to next element in iterator
512 NetworkTransaction txn = new NetworkTransaction();
513 txn.setDescriptor(descriptor);
514 txn.setLink(linkDescriptor.getSelfLink());
515 txn.setOperationType(HttpMethod.GET);
516 txn.setEntityType(linkDescriptor.getEntityType());
518 aaiWorkOnHand.incrementAndGet();
520 supplyAsync(new PerformActiveInventoryRetrieval(txn, aaiAdapter), aaiExecutor)
521 .whenComplete((result, error) -> {
523 aaiWorkOnHand.decrementAndGet();
526 LOG.error(AaiUiMsgs.AAI_RETRIEVAL_FAILED_GENERIC, error.getLocalizedMessage());
528 if (result == null) {
529 LOG.error(AaiUiMsgs.AAI_RETRIEVAL_FAILED_FOR_SELF_LINK,
530 linkDescriptor.getSelfLink());
532 updateActiveInventoryCounters(result);
533 fetchDocumentForUpsert(result);
544 * Fetch document for upsert.
548 private void fetchDocumentForUpsert(NetworkTransaction txn) {
550 if (!txn.getOperationResult().wasSuccessful()) {
551 String message = "Self link failure. Result - " + txn.getOperationResult().getResult();
552 LOG.error(AaiUiMsgs.ERROR_GENERIC, message);
557 final String jsonResult = txn.getOperationResult().getResult();
558 if (jsonResult != null && jsonResult.length() > 0) {
560 AggregationEntity ae = new AggregationEntity();
561 ae.setLink(ActiveInventoryConfig.extractResourcePath(txn.getLink()));
562 populateAggregationEntityDocument(ae, jsonResult, txn.getDescriptor());
567 link = getElasticFullUrl("/" + ae.getId(), getIndexName());
568 } catch (Exception exc) {
569 LOG.error(AaiUiMsgs.ES_FAILED_TO_CONSTRUCT_QUERY, exc.getLocalizedMessage());
573 NetworkTransaction n2 = new NetworkTransaction();
575 n2.setEntityType(txn.getEntityType());
576 n2.setDescriptor(txn.getDescriptor());
577 n2.setOperationType(HttpMethod.GET);
579 esWorkOnHand.incrementAndGet();
581 supplyAsync(new PerformElasticSearchRetrieval(n2, elasticSearchAdapter), esExecutor)
582 .whenComplete((result, error) -> {
584 esWorkOnHand.decrementAndGet();
587 LOG.error(AaiUiMsgs.ES_RETRIEVAL_FAILED, error.getLocalizedMessage());
589 updateElasticSearchCounters(result);
590 performDocumentUpsert(result, ae);
596 } catch (JsonProcessingException exc) {
597 // TODO -> LOG, waht should be logged here?
598 } catch (IOException exc) {
599 // TODO -> LOG, waht should be logged here?
605 * Populate aggregation entity document.
608 * @param result the result
609 * @param resultDescriptor the result descriptor
610 * @throws JsonProcessingException the json processing exception
611 * @throws IOException Signals that an I/O exception has occurred.
613 protected void populateAggregationEntityDocument(AggregationEntity doc, String result,
614 OxmEntityDescriptor resultDescriptor) throws JsonProcessingException, IOException {
615 doc.setEntityType(resultDescriptor.getEntityName());
616 JsonNode entityNode = mapper.readTree(result);
617 Map<String, Object> map = mapper.convertValue(entityNode, Map.class);
618 doc.copyAttributeKeyValuePair(map);
622 * Process entity type self links.
624 * @param operationResult the operation result
626 private void processEntityTypeSelfLinks(OperationResult operationResult) {
628 JsonNode rootNode = null;
630 final String jsonResult = operationResult.getResult();
632 if (jsonResult != null && jsonResult.length() > 0 && operationResult.wasSuccessful()) {
635 rootNode = mapper.readTree(jsonResult);
636 } catch (IOException exc) {
637 String message = "Could not deserialize JSON (representing operation result) as node tree. "
638 + "Operation result = " + jsonResult + ". " + exc.getLocalizedMessage();
639 LOG.error(AaiUiMsgs.JSON_PROCESSING_ERROR, message);
642 JsonNode resultData = rootNode.get("result-data");
643 ArrayNode resultDataArrayNode = null;
645 if (resultData.isArray()) {
646 resultDataArrayNode = (ArrayNode) resultData;
648 Iterator<JsonNode> elementIterator = resultDataArrayNode.elements();
649 JsonNode element = null;
651 while (elementIterator.hasNext()) {
652 element = elementIterator.next();
654 final String resourceType = NodeUtils.getNodeFieldAsText(element, "resource-type");
655 final String resourceLink = NodeUtils.getNodeFieldAsText(element, "resource-link");
657 OxmEntityDescriptor descriptor = null;
659 if (resourceType != null && resourceLink != null) {
661 descriptor = OxmEntityLookup.getInstance().getEntityDescriptors().get(resourceType);
663 if (descriptor == null) {
664 LOG.error(AaiUiMsgs.MISSING_ENTITY_DESCRIPTOR, resourceType);
665 // go to next element in iterator
669 selflinks.add(new SelfLinkDescriptor(resourceLink,
670 SynchronizerConstants.NODES_ONLY_MODIFIER, resourceType));
683 * @see org.openecomp.sparky.synchronizer.IndexSynchronizer#doSync()
686 public OperationState doSync() {
687 this.syncDurationInMs = -1;
688 syncStartedTimeStampInMs = System.currentTimeMillis();
689 String txnID = NodeUtils.getRandomTxnId();
690 MdcContext.initialize(txnID, "AggregationSynchronizer", "", "Sync", "");
692 return collectAllTheWork();
696 public SynchronizerState getState() {
699 return SynchronizerState.PERFORMING_SYNCHRONIZATION;
702 return SynchronizerState.IDLE;
709 * @see org.openecomp.sparky.synchronizer.IndexSynchronizer#getStatReport(boolean)
712 public String getStatReport(boolean showFinalReport) {
713 syncDurationInMs = System.currentTimeMillis() - syncStartedTimeStampInMs;
714 return getStatReport(syncDurationInMs, showFinalReport);
717 public String getEntityType() {
721 public void setEntityType(String entityType) {
722 this.entityType = entityType;
728 * @see org.openecomp.sparky.synchronizer.IndexSynchronizer#shutdown()
731 public void shutdown() {
732 this.shutdownExecutors();
736 protected boolean isSyncDone() {
738 int totalWorkOnHand = aaiWorkOnHand.get() + esWorkOnHand.get();
740 if (LOG.isDebugEnabled()) {
741 LOG.debug(AaiUiMsgs.DEBUG_GENERIC, indexName + ", isSyncDone(), totalWorkOnHand = "
742 + totalWorkOnHand + " all work enumerated = " + allWorkEnumerated);
745 if (totalWorkOnHand > 0 || !allWorkEnumerated) {
749 this.syncInProgress = false;
757 * @see org.openecomp.sparky.synchronizer.AbstractEntitySynchronizer#clearCache()
760 public void clearCache() {
762 if (syncInProgress) {
763 LOG.debug(AaiUiMsgs.DEBUG_GENERIC,
764 "Autosuggestion Entity Summarizer in progress, request to clear cache ignored");
769 this.resetCounters();
770 if (entityCounters != null) {
771 entityCounters.clear();
774 allWorkEnumerated = false;