You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/08/22 16:15:58 UTC
[62/95] [abbrv] git commit: Updating job metadata only every 50
entities
Updating job metadata only every 50 entities
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/1cae490c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/1cae490c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/1cae490c
Branch: refs/heads/import-feature
Commit: 1cae490c52ce6081b81b5dda515a2f61bf520961
Parents: db69a4e
Author: Pooja Jain <pj...@apigee.com>
Authored: Tue Jul 29 10:56:21 2014 -0700
Committer: Pooja Jain <pj...@apigee.com>
Committed: Tue Jul 29 10:56:21 2014 -0700
----------------------------------------------------------------------
.../usergrid/management/importUG/ImportServiceImpl.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1cae490c/stack/services/src/main/java/org/apache/usergrid/management/importUG/ImportServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/importUG/ImportServiceImpl.java b/stack/services/src/main/java/org/apache/usergrid/management/importUG/ImportServiceImpl.java
index 2dcc226..59281b4 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/importUG/ImportServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/importUG/ImportServiceImpl.java
@@ -66,6 +66,8 @@ public class ImportServiceImpl implements ImportService {
private JsonFactory jsonFactory = new JsonFactory();
+ private int entityCount=0;
+
/**
*
* @param config configuration of the job to be scheduled
@@ -428,6 +430,8 @@ public class ImportServiceImpl implements ImportService {
Import importUG = getImportEntity(jobExecution);
EntityManager rootEm = emf.getEntityManager(MANAGEMENT_APPLICATION_ID);
+
+
Map<String,Object> fileMetadata = new HashMap<String, Object>();
ArrayList<Map<String,Object>> value = new ArrayList<Map<String, Object>>();
@@ -620,8 +624,12 @@ public class ImportServiceImpl implements ImportService {
}
// update the last updated entity
if(entity != null) {
- ((Map<String, Object>) fileNames.get(index)).put("lastUpdatedUUID", entityUuid);
- rootEm.update(importUG);
+ entityCount++;
+ if(entityCount == 50) {
+ ((Map<String, Object>) fileNames.get(index)).put("lastUpdatedUUID", entityUuid);
+ rootEm.update(importUG);
+ entityCount = 0;
+ }
}
}
}