summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r--src/main/java/org/onap/aai/sparky/aggregation/sync/AggregationSynchronizer.java24
-rw-r--r--src/main/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizer.java48
-rw-r--r--src/main/java/org/onap/aai/sparky/crossentityreference/sync/CrossEntityReferenceSynchronizer.java106
-rw-r--r--src/main/java/org/onap/aai/sparky/dal/elasticsearch/SearchAdapter.java6
-rw-r--r--src/main/java/org/onap/aai/sparky/sync/AbstractEntitySynchronizer.java20
-rw-r--r--src/main/java/org/onap/aai/sparky/util/NodeUtils.java4
-rw-r--r--src/main/java/org/onap/aai/sparky/viewandinspect/services/BaseVisualizationContext.java172
7 files changed, 193 insertions, 187 deletions
diff --git a/src/main/java/org/onap/aai/sparky/aggregation/sync/AggregationSynchronizer.java b/src/main/java/org/onap/aai/sparky/aggregation/sync/AggregationSynchronizer.java
index 36cd8bc..3b02ff0 100644
--- a/src/main/java/org/onap/aai/sparky/aggregation/sync/AggregationSynchronizer.java
+++ b/src/main/java/org/onap/aai/sparky/aggregation/sync/AggregationSynchronizer.java
@@ -176,9 +176,8 @@ public class AggregationSynchronizer extends AbstractEntitySynchronizer
aaiWorkOnHand.decrementAndGet();
processEntityTypeSelfLinks(typeLinksResult);
} catch (Exception exc) {
- // TODO -> LOG, what should be logged here?
-
- exc.printStackTrace();
+ LOG.error(AaiUiMsgs.ERROR_GENERIC, "Processing execption while building working set. Error:"
+ + exc.getMessage());
}
return null;
@@ -589,12 +588,15 @@ public class AggregationSynchronizer extends AbstractEntitySynchronizer
}
}
- } catch (JsonProcessingException exc) {
- // TODO -> LOG, waht should be logged here?
- } catch (IOException exc) {
- // TODO -> LOG, waht should be logged here?
- }
- }
+ } catch (JsonProcessingException exc) {
+ LOG.error(AaiUiMsgs.ERROR_GENERIC,
+ "There was a JSON processing error fetching the elastic document for upsert. Error: "
+ + exc.getMessage());
+ } catch (IOException exc) {
+ LOG.error(AaiUiMsgs.ERROR_GENERIC,
+ "There was an IO error fetching the elastic document for upsert. Error: " + exc.getMessage());
+ }
+ }
/**
@@ -622,6 +624,10 @@ public class AggregationSynchronizer extends AbstractEntitySynchronizer
private void processEntityTypeSelfLinks(OperationResult operationResult) {
JsonNode rootNode = null;
+
+ if ( operationResult == null ) {
+ return;
+ }
final String jsonResult = operationResult.getResult();
diff --git a/src/main/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizer.java b/src/main/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizer.java
index 709842a..5172fe8 100644
--- a/src/main/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizer.java
+++ b/src/main/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizer.java
@@ -143,6 +143,8 @@ public class AutosuggestionSynchronizer extends AbstractEntitySynchronizer
this.syncInProgress = false;
this.contextMap = MDC.getCopyOfContextMap();
this.esPutExecutor = NodeUtils.createNamedExecutor("SUES-ES-PUT", 5, LOG);
+ this.retryQueue = new ConcurrentLinkedDeque<RetrySuggestionEntitySyncContainer>();
+ this.retryLimitTracker = new ConcurrentHashMap<String, Integer>();
this.syncDurationInMs = -1;
this.filtersConfig = filtersConfig;
}
@@ -187,7 +189,9 @@ public class AutosuggestionSynchronizer extends AbstractEntitySynchronizer
aaiWorkOnHand.decrementAndGet();
processEntityTypeSelfLinks(typeLinksResult);
} catch (Exception exc) {
- // TODO -> LOG, what should be logged here?
+ LOG.error(AaiUiMsgs.ERROR_GENERIC,
+ "An error occurred while processing entity self-links. Error: "
+ + exc.getMessage());
}
return null;
@@ -228,7 +232,8 @@ public class AutosuggestionSynchronizer extends AbstractEntitySynchronizer
retryLimitTracker.clear();
} catch (Exception exc) {
- // TODO -> LOG, waht should be logged here?
+ LOG.error(AaiUiMsgs.ERROR_GENERIC,
+ "An error occurred while performing the sync. Error: " + exc.getMessage());
}
return OperationState.OK;
@@ -258,6 +263,10 @@ public class AutosuggestionSynchronizer extends AbstractEntitySynchronizer
private void processEntityTypeSelfLinks(OperationResult operationResult) {
JsonNode rootNode = null;
+
+ if ( operationResult == null ) {
+ return;
+ }
final String jsonResult = operationResult.getResult();
@@ -361,25 +370,38 @@ public class AutosuggestionSynchronizer extends AbstractEntitySynchronizer
}
/*
- * Return a set of valid suggestion attributes for the provided entityName
- * that are present in the JSON
+ * Return a set of valid suggestion attributes for the provided entityName that are present in the
+ * JSON
+ *
* @param node JSON node in which the attributes should be found
+ *
* @param entityName Name of the entity
+ *
* @return List of all valid suggestion attributes(key's)
*/
public List<String> getSuggestableAttrNamesFromReponse(JsonNode node, String entityName) {
List<String> suggestableAttr = new ArrayList<String>();
+
HashMap<String, String> desc =
suggestionEntityLookup.getSuggestionSearchEntityOxmModel().get(entityName);
- String attr = desc.get("suggestibleAttributes");
- suggestableAttr = Arrays.asList(attr.split(","));
- List<String> suggestableValue = new ArrayList<>();
- for (String attribute : suggestableAttr) {
- if (node.get(attribute) != null && node.get(attribute).asText().length() > 0) {
- suggestableValue.add(attribute);
+
+ if (desc != null) {
+
+ String attr = desc.get("suggestibleAttributes");
+
+ if (attr != null) {
+ suggestableAttr = Arrays.asList(attr.split(","));
+ List<String> suggestableValue = new ArrayList<String>();
+ for (String attribute : suggestableAttr) {
+ if (node.get(attribute) != null && node.get(attribute).asText().length() > 0) {
+ suggestableValue.add(attribute);
+ }
+ }
+ return suggestableValue;
}
}
- return suggestableValue;
+
+ return new ArrayList<String>();
}
/**
@@ -454,9 +476,9 @@ public class AutosuggestionSynchronizer extends AbstractEntitySynchronizer
}
}
} catch (JsonProcessingException exc) {
- // TODO -> LOG, waht should be logged here?
+ LOG.error(AaiUiMsgs.ERROR_GENERIC, "There was a json processing error while processing the result from elasticsearch. Error: " + exc.getMessage());
} catch (IOException exc) {
- // TODO -> LOG, waht should be logged here?
+ LOG.error(AaiUiMsgs.ERROR_GENERIC, "There was a io processing error while processing the result from elasticsearch. Error: " + exc.getMessage());
}
}
diff --git a/src/main/java/org/onap/aai/sparky/crossentityreference/sync/CrossEntityReferenceSynchronizer.java b/src/main/java/org/onap/aai/sparky/crossentityreference/sync/CrossEntityReferenceSynchronizer.java
index 0f0cce1..94a400b 100644
--- a/src/main/java/org/onap/aai/sparky/crossentityreference/sync/CrossEntityReferenceSynchronizer.java
+++ b/src/main/java/org/onap/aai/sparky/crossentityreference/sync/CrossEntityReferenceSynchronizer.java
@@ -243,7 +243,8 @@ public class CrossEntityReferenceSynchronizer extends AbstractEntitySynchronizer
aaiWorkOnHand.decrementAndGet();
processEntityTypeSelfLinks(typeLinksResult);
} catch (Exception exc) {
- // TODO -> LOG, what should be logged here?
+ LOG.error(AaiUiMsgs.ERROR_GENERIC,
+ "An error occurred processing entity selflinks. Error: " + exc.getMessage());
}
return null;
@@ -281,7 +282,9 @@ public class CrossEntityReferenceSynchronizer extends AbstractEntitySynchronizer
retryLimitTracker.clear();
} catch (Exception exc) {
- // TODO -> LOG, waht should be logged here?
+ LOG.error(AaiUiMsgs.ERROR_GENERIC,
+ "An error occurred during entity synchronization. Error: " + exc.getMessage());
+
}
return OperationState.OK;
@@ -564,56 +567,57 @@ public class CrossEntityReferenceSynchronizer extends AbstractEntitySynchronizer
* link, this should be a permanent error
*/
LOG.error(AaiUiMsgs.ENTITY_SYNC_FAILED_SELFLINK_AMBIGUITY, String.valueOf(entityLinks.size()));
- } else {
- selfLink = ((JsonNode) entityLinks.toArray()[0]).asText();
-
- SearchableOxmEntityDescriptor searchableDescriptor = searchableEntityLookup.getSearchableEntityDescriptors().get( txn.getEntityType());
-
- if (searchableDescriptor != null && searchableDescriptor.getSearchableAttributes().size() > 0) {
-
- IndexableCrossEntityReference icer =
- getPopulatedDocument(targetEntityInstance, cerDescriptor);
-
- for (String parentCrossEntityReferenceAttributeValue : extractedParentEntityAttributeValues) {
- icer.addCrossEntityReferenceValue(
- parentCrossEntityReferenceAttributeValue);
- }
-
- icer.setLink(ActiveInventoryAdapter.extractResourcePath(selfLink));
-
- icer.deriveFields();
-
- String link = null;
- try {
- link = elasticSearchAdapter.buildElasticSearchGetDocUrl(getIndexName(), icer.getId());
- } catch (Exception exc) {
- LOG.error(AaiUiMsgs.ES_FAILED_TO_CONSTRUCT_QUERY, exc.getLocalizedMessage());
- }
-
- if (link != null) {
- NetworkTransaction n2 = new NetworkTransaction();
- n2.setLink(link);
- n2.setEntityType(txn.getEntityType());
- n2.setDescriptor(txn.getDescriptor());
- n2.setOperationType(HttpMethod.GET);
-
- esWorkOnHand.incrementAndGet();
-
- supplyAsync(new PerformElasticSearchRetrieval(n2, elasticSearchAdapter),
- esExecutor).whenComplete((result, error) -> {
-
- esWorkOnHand.decrementAndGet();
-
- if (error != null) {
- LOG.error(AaiUiMsgs.ES_RETRIEVAL_FAILED, error.getLocalizedMessage());
- } else {
- updateElasticSearchCounters(result);
- performDocumentUpsert(result, icer);
- }
- });
- }
- }
+ } else {
+ selfLink = ((JsonNode) entityLinks.toArray()[0]).asText();
+
+
+ IndexableCrossEntityReference icer =
+ getPopulatedDocument(targetEntityInstance, cerDescriptor);
+
+ for (String parentCrossEntityReferenceAttributeValue : extractedParentEntityAttributeValues) {
+ icer.addCrossEntityReferenceValue(
+ parentCrossEntityReferenceAttributeValue);
+ }
+
+ icer.setLink(ActiveInventoryAdapter.extractResourcePath(selfLink));
+
+ icer.deriveFields();
+
+ String link = null;
+ try {
+ link = elasticSearchAdapter
+ .buildElasticSearchGetDocUrl(getIndexName(), icer.getId());
+ } catch (Exception exc) {
+ LOG.error(AaiUiMsgs.ES_FAILED_TO_CONSTRUCT_QUERY,
+ exc.getLocalizedMessage());
}
+
+ if (link != null) {
+ NetworkTransaction n2 = new NetworkTransaction();
+ n2.setLink(link);
+ n2.setEntityType(txn.getEntityType());
+ n2.setDescriptor(txn.getDescriptor());
+ n2.setOperationType(HttpMethod.GET);
+
+ esWorkOnHand.incrementAndGet();
+
+ supplyAsync(
+ new PerformElasticSearchRetrieval(n2, elasticSearchAdapter),
+ esExecutor).whenComplete((result, error) -> {
+
+ esWorkOnHand.decrementAndGet();
+
+ if (error != null) {
+ LOG.error(AaiUiMsgs.ES_RETRIEVAL_FAILED,
+ error.getLocalizedMessage());
+ } else {
+ updateElasticSearchCounters(result);
+ performDocumentUpsert(result, icer);
+ }
+ });
+ }
+
+ }
} else {
LOG.error(AaiUiMsgs.ENTITY_SYNC_FAILED_DURING_AAI_RESPONSE_CONVERSION);
}
diff --git a/src/main/java/org/onap/aai/sparky/dal/elasticsearch/SearchAdapter.java b/src/main/java/org/onap/aai/sparky/dal/elasticsearch/SearchAdapter.java
index c4e81b7..3abb54a 100644
--- a/src/main/java/org/onap/aai/sparky/dal/elasticsearch/SearchAdapter.java
+++ b/src/main/java/org/onap/aai/sparky/dal/elasticsearch/SearchAdapter.java
@@ -37,7 +37,7 @@ import org.onap.aai.restclient.client.OperationResult;
import org.onap.aai.restclient.client.RestClient;
import org.onap.aai.sparky.dal.sas.config.SearchServiceConfig;
import org.onap.aai.sparky.util.Encryptor;
-import org.onap.aai.sparky.viewandinspect.config.TierSupportUiConstants;
+import org.onap.aai.sparky.viewandinspect.config.SparkyConstants;
import org.slf4j.MDC;
@@ -63,9 +63,9 @@ public class SearchAdapter {
Encryptor encryptor = new Encryptor();
client = new RestClient().validateServerHostname(false).validateServerCertChain(false)
- .clientCertFile(TierSupportUiConstants.CONFIG_AUTH_LOCATION + sasConfig.getCertName())
+ .clientCertFile(SparkyConstants.CONFIG_AUTH_LOCATION + sasConfig.getCertName())
.clientCertPassword(encryptor.decryptValue(sasConfig.getKeystorePassword()))
- .trustStore(TierSupportUiConstants.CONFIG_AUTH_LOCATION + sasConfig.getKeystore());
+ .trustStore(SparkyConstants.CONFIG_AUTH_LOCATION + sasConfig.getKeystore());
commonHeaders = new HashMap<String, List<String>>();
commonHeaders.put("Accept", Arrays.asList("application/json"));
diff --git a/src/main/java/org/onap/aai/sparky/sync/AbstractEntitySynchronizer.java b/src/main/java/org/onap/aai/sparky/sync/AbstractEntitySynchronizer.java
index 298a493..bd55f3c 100644
--- a/src/main/java/org/onap/aai/sparky/sync/AbstractEntitySynchronizer.java
+++ b/src/main/java/org/onap/aai/sparky/sync/AbstractEntitySynchronizer.java
@@ -411,16 +411,6 @@ public abstract class AbstractEntitySynchronizer {
* 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.
- *
- * @param method the method
* @param entityType the entity type
* @param or the or
*/
@@ -469,16 +459,6 @@ public abstract class AbstractEntitySynchronizer {
* 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.
- *
- * @param method the method
* @param entityType the entity type
* @param or the or
*/
diff --git a/src/main/java/org/onap/aai/sparky/util/NodeUtils.java b/src/main/java/org/onap/aai/sparky/util/NodeUtils.java
index 94c2b3e..7657d7e 100644
--- a/src/main/java/org/onap/aai/sparky/util/NodeUtils.java
+++ b/src/main/java/org/onap/aai/sparky/util/NodeUtils.java
@@ -404,12 +404,12 @@ public class NodeUtils {
String resourceId = null;
if ("/".equals(link.substring(linkLength - 1))) {
// Use-case:
- // https://ext1.test.onap.com:9292/aai/v7/business/customers/customer/1607_20160524Func_Ak1_01/service-subscriptions/service-subscription/uCPE-VMS/
+ // https://ext1.test.onap.com:9292/aai/v7/business/customers/customer/customer-1/service-subscriptions/service-subscription/service-subscription-1/
startIndex = link.lastIndexOf("/", linkLength - 2);
resourceId = link.substring(startIndex + 1, linkLength - 1);
} else {
// Use-case:
- // https://ext1.test.onap.com:9292/aai/v7/business/customers/customer/1607_20160524Func_Ak1_01/service-subscriptions/service-subscription/uCPE-VMS
+ // https://ext1.test.onap.com:9292/aai/v7/business/customers/customer/customer-1/service-subscriptions/service-subscription/service-subscription-1
startIndex = link.lastIndexOf("/");
resourceId = link.substring(startIndex + 1, linkLength);
}
diff --git a/src/main/java/org/onap/aai/sparky/viewandinspect/services/BaseVisualizationContext.java b/src/main/java/org/onap/aai/sparky/viewandinspect/services/BaseVisualizationContext.java
index 42e8d05..e5430af 100644
--- a/src/main/java/org/onap/aai/sparky/viewandinspect/services/BaseVisualizationContext.java
+++ b/src/main/java/org/onap/aai/sparky/viewandinspect/services/BaseVisualizationContext.java
@@ -98,6 +98,7 @@ public class BaseVisualizationContext implements VisualizationContext {
private ExecutorService aaiExecutorService;
private OxmEntityLookup oxmEntityLookup;
+ private boolean rootNodeFound;
/*
* The node cache is intended to be a flat structure indexed by a primary key to avoid needlessly
@@ -137,8 +138,17 @@ public class BaseVisualizationContext implements VisualizationContext {
this.mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_EMPTY);
mapper.setPropertyNamingStrategy(new PropertyNamingStrategy.KebabCaseStrategy());
+ this.rootNodeFound = false;
}
+ protected boolean isRootNodeFound() {
+ return rootNodeFound;
+ }
+
+ protected void setRootNodeFound(boolean rootNodeFound) {
+ this.rootNodeFound = rootNodeFound;
+ }
+
public long getContextId() {
return contextId;
}
@@ -351,7 +361,7 @@ public class BaseVisualizationContext implements VisualizationContext {
aaiWorkOnHand.incrementAndGet();
supplyAsync(new PerformSelfLinkDeterminationTask(txn, null, aaiAdapter),
aaiExecutorService).whenComplete((nodeTxn, error) -> {
- aaiWorkOnHand.decrementAndGet();
+
if (error != null) {
LOG.error(AaiUiMsgs.SELF_LINK_DETERMINATION_FAILED_GENERIC, selfLinkQuery);
} else {
@@ -435,6 +445,8 @@ public class BaseVisualizationContext implements VisualizationContext {
}
}
+
+ aaiWorkOnHand.decrementAndGet();
});
@@ -671,7 +683,7 @@ public class BaseVisualizationContext implements VisualizationContext {
supplyAsync(
new PerformNodeSelfLinkProcessingTask(txn, depthModifier, aaiAdapter),
aaiExecutorService).whenComplete((nodeTxn, error) -> {
- aaiWorkOnHand.decrementAndGet();
+
if (error != null) {
/*
@@ -729,6 +741,8 @@ public class BaseVisualizationContext implements VisualizationContext {
}
}
+
+ aaiWorkOnHand.decrementAndGet();
});
@@ -793,7 +807,11 @@ public class BaseVisualizationContext implements VisualizationContext {
* @param queryParams the query params
* @return true, if successful
*/
- private boolean findAndMarkRootNode(QueryParams queryParams) {
+ private void findAndMarkRootNode(QueryParams queryParams) {
+
+ if (isRootNodeFound()) {
+ return;
+ }
for (ActiveInventoryNode cacheNode : nodeCache.values()) {
@@ -801,12 +819,10 @@ public class BaseVisualizationContext implements VisualizationContext {
cacheNode.setNodeDepth(0);
cacheNode.setRootNode(true);
LOG.info(AaiUiMsgs.ROOT_NODE_DISCOVERED, queryParams.getSearchTargetNodeId());
- return true;
+ setRootNodeFound(true);
}
}
- return false;
-
}
/**
@@ -814,14 +830,15 @@ public class BaseVisualizationContext implements VisualizationContext {
*
* @param rootNodeDiscovered the root node discovered
*/
- private void processCurrentNodeStates(boolean rootNodeDiscovered) {
+ private void processCurrentNodeStates(QueryParams queryParams) {
/*
* Force an evaluation of node depths before determining if we should limit state-based
* traversal or processing.
*/
- if (rootNodeDiscovered) {
- evaluateNodeDepths();
- }
+
+ findAndMarkRootNode(queryParams);
+
+ verifyOutboundNeighbors();
for (ActiveInventoryNode cacheNode : nodeCache.values()) {
@@ -861,16 +878,15 @@ public class BaseVisualizationContext implements VisualizationContext {
* around the root node.
*/
- if (!rootNodeDiscovered || cacheNode.getNodeDepth() < this.visualizationConfigs.getMaxSelfLinkTraversalDepth()) {
+ if (!isRootNodeFound() || cacheNode.getNodeDepth() < this.visualizationConfigs
+ .getMaxSelfLinkTraversalDepth()) {
if (LOG.isDebugEnabled()) {
LOG.debug(AaiUiMsgs.DEBUG_GENERIC,
- "SLNC::processCurrentNodeState() -- Node at max depth,"
+ "processCurrentNodeState() -- Node at max depth,"
+ " halting processing at current state = -- "
+ cacheNode.getState() + " nodeId = " + cacheNode.getNodeId());
}
-
-
processNeighbors(cacheNode.getNodeId());
@@ -880,9 +896,6 @@ public class BaseVisualizationContext implements VisualizationContext {
}
default:
break;
-
-
-
}
}
@@ -1347,10 +1360,13 @@ public class BaseVisualizationContext implements VisualizationContext {
* always be equal to zero.
*/
- if (queryParams.getSearchTargetNodeId().equals(newNode.getNodeId())) {
- newNode.setNodeDepth(0);
- newNode.setRootNode(true);
- LOG.info(AaiUiMsgs.ROOT_NODE_DISCOVERED, queryParams.getSearchTargetNodeId());
+ if (!isRootNodeFound()) {
+ if (queryParams.getSearchTargetNodeId().equals(newNode.getNodeId())) {
+ newNode.setNodeDepth(0);
+ newNode.setRootNode(true);
+ LOG.info(AaiUiMsgs.ROOT_NODE_DISCOVERED, queryParams.getSearchTargetNodeId());
+ setRootNodeFound(true);
+ }
}
newNode.setSelfLink(searchTargetEntity.getLink());
@@ -1358,22 +1374,14 @@ public class BaseVisualizationContext implements VisualizationContext {
nodeCache.putIfAbsent(newNode.getNodeId(), newNode);
}
- /**
- * Checks for out standing work.
- *
- * @return true, if successful
- */
- private boolean hasOutStandingWork() {
-
+ private int getTotalWorkOnHand() {
+
int numNodesWithPendingStates = 0;
-
- /*
- * Force an evaluation of node depths before determining if we should limit state-based
- * traversal or processing.
- */
-
- evaluateNodeDepths();
-
+
+ if( isRootNodeFound()) {
+ evaluateNodeDepths();
+ }
+
for (ActiveInventoryNode n : nodeCache.values()) {
switch (n.getState()) {
@@ -1410,9 +1418,39 @@ public class BaseVisualizationContext implements VisualizationContext {
}
- LOG.debug(AaiUiMsgs.OUTSTANDING_WORK_PENDING_NODES, String.valueOf(numNodesWithPendingStates));
+ LOG.debug(AaiUiMsgs.OUTSTANDING_WORK_PENDING_NODES,
+ String.valueOf(numNodesWithPendingStates));
- return (numNodesWithPendingStates > 0);
+ int totalWorkOnHand = aaiWorkOnHand.get() + numNodesWithPendingStates;
+
+ return totalWorkOnHand;
+
+ }
+
+ /**
+ * Checks for out standing work.
+ *
+ * @return true, if successful
+ */
+ private void processOutstandingWork(QueryParams queryParams) {
+
+ while (getTotalWorkOnHand() > 0) {
+
+ /*
+ * Force an evaluation of node depths before determining if we should limit state-based
+ * traversal or processing.
+ */
+
+ processCurrentNodeStates(queryParams);
+
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException exc) {
+ LOG.error(AaiUiMsgs.PROCESSING_LOOP_INTERUPTED, exc.getMessage());
+ return;
+ }
+
+ }
}
@@ -1424,70 +1462,26 @@ public class BaseVisualizationContext implements VisualizationContext {
try {
+
if (searchtargetEntity == null) {
LOG.error(AaiUiMsgs.SELF_LINK_PROCESSING_ERROR, contextIdStr + " - Failed to"
+ " processSelfLinks, searchtargetEntity is null");
return;
}
- processSearchableEntity(searchtargetEntity, queryParams);
-
long startTimeInMs = System.currentTimeMillis();
- /*
- * wait until all transactions are complete or guard-timer expires.
- */
-
- long totalResolveTime = 0;
- boolean hasOutstandingWork = hasOutStandingWork();
- boolean outstandingWorkGuardTimerFired = false;
- long maxGuardTimeInMs = 5000;
- long guardTimeInMs = 0;
- boolean foundRootNode = false;
-
+ processSearchableEntity(searchtargetEntity, queryParams);
/*
- * TODO: Put a count-down-latch in place of the while loop, but if we do that then
- * we'll need to decouple the visualization processing from the main thread so it can continue to process while
- * the main thread is waiting on for count-down-latch gate to open. This may also be easier once we move to the
- * VisualizationService + VisualizationContext ideas.
+ * This method is blocking until we decouple it with a CountDownLatch await condition,
+ * and make the internal graph processing more event-y.
*/
-
- while (hasOutstandingWork || !outstandingWorkGuardTimerFired) {
-
- if (!foundRootNode) {
- foundRootNode = findAndMarkRootNode(queryParams);
- }
-
- processCurrentNodeStates(foundRootNode);
-
- verifyOutboundNeighbors();
-
- try {
- Thread.sleep(500);
- } catch (InterruptedException exc) {
- LOG.error(AaiUiMsgs.PROCESSING_LOOP_INTERUPTED, exc.getMessage());
- return;
- }
-
- totalResolveTime = (System.currentTimeMillis() - startTimeInMs);
-
- if (!hasOutstandingWork) {
-
- guardTimeInMs += 500;
-
- if (guardTimeInMs > maxGuardTimeInMs) {
- outstandingWorkGuardTimerFired = true;
- }
- } else {
- guardTimeInMs = 0;
- }
-
- hasOutstandingWork = hasOutStandingWork();
-
- }
+ processOutstandingWork(queryParams);
+ long totalResolveTime = (System.currentTimeMillis() - startTimeInMs);
+
long opTime = System.currentTimeMillis() - startTimeInMs;
LOG.info(AaiUiMsgs.ALL_TRANSACTIONS_RESOLVED, String.valueOf(totalResolveTime),