This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/master by this push:
new 1d2aad5 ATLAS-3297: cache added/update entities in request-context,
for use in entity-change listeners
1d2aad5 is described below
commit 1d2aad52f1053ac03edad78f9568d62010617a97
Author: Madhan Neethiraj <[email protected]>
AuthorDate: Fri Jun 21 14:37:27 2019 -0700
ATLAS-3297: cache added/update entities in request-context, for use in
entity-change listeners
---
.../atlas/repository/store/graph/v2/EntityGraphMapper.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
index 64f5503..af74313 100644
---
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
+++
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
@@ -195,7 +195,8 @@ public class EntityGraphMapper {
public EntityMutationResponse
mapAttributesAndClassifications(EntityMutationContext context, final boolean
isPartialUpdate, final boolean replaceClassifications) throws
AtlasBaseException {
MetricRecorder metric =
RequestContext.get().startMetricRecord("mapAttributesAndClassifications");
- EntityMutationResponse resp = new EntityMutationResponse();
+ EntityMutationResponse resp = new EntityMutationResponse();
+ RequestContext reqContext = RequestContext.get();
Collection<AtlasEntity> createdEntities = context.getCreatedEntities();
Collection<AtlasEntity> updatedEntities = context.getUpdatedEntities();
@@ -212,6 +213,8 @@ public class EntityGraphMapper {
resp.addEntity(CREATE, constructHeader(createdEntity,
entityType, vertex));
addClassifications(context, guid,
createdEntity.getClassifications());
+
+ reqContext.cache(createdEntity);
}
}
@@ -231,10 +234,12 @@ public class EntityGraphMapper {
resp.addEntity(UPDATE, constructHeader(updatedEntity,
entityType, vertex));
}
- if ( replaceClassifications ) {
+ if (replaceClassifications) {
deleteClassifications(guid);
addClassifications(context, guid,
updatedEntity.getClassifications());
}
+
+ reqContext.cache(updatedEntity);
}
}