diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-06-17 09:27:21 +0200 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-06-18 08:04:15 +0200 |
commit | 873d6892fc66d2efb3cc2b3cc10807db47bcaffa (patch) | |
tree | f787c11f0fbb019219b93e30f54e090601b77179 /aai-traversal/src/main | |
parent | 37356037d270462969e84429ba0ab3dce3e0d597 (diff) |
Update aai-common to 1.14.1 in traversal1.14.1
- includes tinkerpop update from 3.3.0 to 3.3.11
- update guava from 18 to 25.0-jre
- resolve maven build warnings (undeclared dep versions, duplicate deps, reporting configuration)
Issue-ID: AAI-3879
Change-Id: I60124c42ca1a0c884c02981a18c1c9388e62b6e2
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'aai-traversal/src/main')
-rw-r--r-- | aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java b/aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java index aa4fdad..005d3dc 100644 --- a/aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java +++ b/aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java @@ -26,6 +26,8 @@ import com.google.common.util.concurrent.TimeLimiter; import com.google.common.util.concurrent.UncheckedTimeoutException; import java.util.*; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; @@ -44,6 +46,8 @@ import org.onap.aai.introspection.Introspector; import org.onap.aai.introspection.Loader; import org.onap.aai.introspection.exceptions.AAIUnknownObjectException; import org.onap.aai.logging.ErrorLogHelper; +import org.onap.aai.parsers.exceptions.AAIIdentityMapParseException; +import org.onap.aai.parsers.exceptions.AmbiguousMapAAIException; import org.onap.aai.query.builder.QueryBuilder; import org.onap.aai.schema.enums.PropertyMetadata; import org.onap.aai.serialization.db.DBSerializer; @@ -380,7 +384,7 @@ public class ModelBasedProcessing { } List<ResultSet> resultList = new ArrayList<>(); - TimeLimiter limiter = new SimpleTimeLimiter(); + TimeLimiter limiter = SimpleTimeLimiter.create(Executors.newCachedThreadPool()); try { resultList = limiter.callWithTimeout(new AaiCallable<List<ResultSet>>() { @@ -389,10 +393,17 @@ public class ModelBasedProcessing { modelInvId_f, modelName_f, topNodeType_f, startNodeFilterArrayOfHashes_f, apiVer_f); } - }, timeLimitSec, TimeUnit.SECONDS, true); - } catch (AAIException ae) { - // Re-throw AAIException so we get can tell what happened internally - throw ae; + }, timeLimitSec, TimeUnit.SECONDS); + } catch (ExecutionException ex) { + if(ex.getCause() instanceof AAIIdentityMapParseException) { + throw (AAIIdentityMapParseException) ex.getCause(); + } + if(ex.getCause() instanceof AmbiguousMapAAIException) { + throw (AmbiguousMapAAIException) ex.getCause(); + } + if(ex.getCause() instanceof AAIException) { + throw (AAIException) ex.getCause(); + } } catch (UncheckedTimeoutException ute) { throw new AAIException("AAI_6140", "Query Processing Limit exceeded. (limit = " + timeLimitSec + " seconds)"); @@ -1036,7 +1047,7 @@ public class ModelBasedProcessing { } List<ResultSet> resultList = new ArrayList<>(); - TimeLimiter limiter = new SimpleTimeLimiter(); + TimeLimiter limiter = SimpleTimeLimiter.create(Executors.newCachedThreadPool()); try { resultList = limiter.callWithTimeout(new AaiCallable<List<ResultSet>>() { public List<ResultSet> process() throws AAIException { @@ -1044,11 +1055,17 @@ public class ModelBasedProcessing { startNodeFilterArrayOfHashes_f, apiVer_f, secondaryFilterCutPoint_f, secondaryFilterHash_f); } - }, timeLimitSec, TimeUnit.SECONDS, true); - - } catch (AAIException ae) { - // Re-throw AAIException so we get can tell what happened internally - throw ae; + }, timeLimitSec, TimeUnit.SECONDS); + } catch (ExecutionException ex) { + if(ex.getCause() instanceof AAIIdentityMapParseException) { + throw (AAIIdentityMapParseException) ex.getCause(); + } + if(ex.getCause() instanceof AmbiguousMapAAIException) { + throw (AmbiguousMapAAIException) ex.getCause(); + } + if(ex.getCause() instanceof AAIException) { + throw (AAIException) ex.getCause(); + } } catch (UncheckedTimeoutException ute) { throw new AAIException("AAI_6140", "Query Processing Limit exceeded. (limit = " + timeLimitSec + " seconds)"); |