You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2014/10/03 21:01:44 UTC
[1/2] git commit: Added tests to forked thread for background
processing.
Repository: incubator-usergrid
Updated Branches:
refs/heads/essingledocument [created] 545619225
Added tests to forked thread for background processing.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/230870be
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/230870be
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/230870be
Branch: refs/heads/essingledocument
Commit: 230870be215eb09add1c34383522798dc33324b2
Parents: deaa46c
Author: Todd Nine <to...@apache.org>
Authored: Thu Oct 2 15:35:03 2014 -0600
Committer: Todd Nine <to...@apache.org>
Committed: Thu Oct 2 15:35:03 2014 -0600
----------------------------------------------------------------------
.../apache/usergrid/rest/SystemResource.java | 67 +++++++++++++++-----
1 file changed, 52 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/230870be/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
index 9a67032..b037b96 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
@@ -122,7 +122,7 @@ public class SystemResource extends AbstractContextResource {
response.setAction( "rebuild indexes" );
- EntityManagerFactory.ProgressObserver po = new EntityManagerFactory.ProgressObserver() {
+ final EntityManagerFactory.ProgressObserver po = new EntityManagerFactory.ProgressObserver() {
@Override
public void onProgress( EntityRef s, EntityRef t, String etype ) {
logger.info( "Indexing from {}:{} to {}:{} edgeType {}", new Object[] {
@@ -132,12 +132,27 @@ public class SystemResource extends AbstractContextResource {
};
- logger.info( "Rebuilding all indexes" );
+ final Thread rebuild = new Thread() {
- emf.rebuildInternalIndexes( po );
- emf.refreshIndex();
+ @Override
+ public void run() {
+ logger.info( "Rebuilding all indexes" );
+
+ try {
+ emf.rebuildInternalIndexes( po );
+ emf.refreshIndex();
+
+ emf.rebuildAllIndexes( po );
+ }
+ catch ( Exception e ) {
+ logger.error( "Unable to rebuild indexes", e );
+ }
+ }
+ };
- emf.rebuildAllIndexes( po );
+ rebuild.setName( "Index rebuild all usergrid" );
+ rebuild.setDaemon( true );
+ rebuild.start();
response.setSuccess();
@@ -148,7 +163,7 @@ public class SystemResource extends AbstractContextResource {
@RequireSystemAccess
@PUT
- @Path( "index/rebuild/" + RootResource.APPLICATION_ID_PATH )
+ @Path( "index/rebuild/" + RootResource.APPLICATION_ID_PATH )
public JSONWithPadding rebuildIndexes( @Context UriInfo ui, @PathParam( "applicationId" ) String applicationIdStr,
@QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
throws Exception {
@@ -158,7 +173,7 @@ public class SystemResource extends AbstractContextResource {
response.setAction( "rebuild indexes" );
- EntityManagerFactory.ProgressObserver po = new EntityManagerFactory.ProgressObserver() {
+ final EntityManagerFactory.ProgressObserver po = new EntityManagerFactory.ProgressObserver() {
@Override
public void onProgress( EntityRef s, EntityRef t, String etype ) {
logger.info( "Indexing from {}:{} to {}:{} edgeType {}", new Object[] {
@@ -168,16 +183,27 @@ public class SystemResource extends AbstractContextResource {
};
- EntityManager em = emf.getEntityManager( appId );
+ final EntityManager em = emf.getEntityManager( appId );
- Set<String> collectionNames = em.getApplicationCollections();
+ final Set<String> collectionNames = em.getApplicationCollections();
+ final Thread rebuild = new Thread() {
- for(String collectionName: collectionNames){
- rebuildCollection(appId, collectionName);
- }
+ @Override
+ public void run() {
+ for ( String collectionName : collectionNames )
+ {
+ rebuildCollection( appId, collectionName );
+ }
+ }
+ };
+
+ rebuild.setName( String.format( "Index rebuild for app %s", appId ) );
+ rebuild.setDaemon( true );
+ rebuild.start();
+
response.setSuccess();
return new JSONWithPadding( response, callback );
@@ -187,8 +213,9 @@ public class SystemResource extends AbstractContextResource {
@RequireSystemAccess
@PUT
@Path( "index/rebuild/" + RootResource.APPLICATION_ID_PATH + "/{collectionName}" )
- public JSONWithPadding rebuildIndexes( @Context UriInfo ui, @PathParam( "applicationId" ) String applicationIdStr,
- @PathParam( "collectionName" ) String collectionName,
+ public JSONWithPadding rebuildIndexes( @Context UriInfo ui,
+ @PathParam( "applicationId" ) final String applicationIdStr,
+ @PathParam( "collectionName" ) final String collectionName,
@QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
throws Exception {
@@ -196,7 +223,17 @@ public class SystemResource extends AbstractContextResource {
ApiResponse response = createApiResponse();
response.setAction( "rebuild indexes" );
- rebuildCollection( appId, collectionName );
+ final Thread rebuild = new Thread() {
+
+ public void run() {
+
+ rebuildCollection( appId, collectionName );
+ }
+ };
+
+ rebuild.setName( String.format( "Index rebuild for app %s and collection %s", appId, collectionName ) );
+ rebuild.setDaemon( true );
+ rebuild.start();
response.setSuccess();
[2/2] git commit: Merge branch 'two-dot-o' of
https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o
Posted by to...@apache.org.
Merge branch 'two-dot-o' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/54561922
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/54561922
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/54561922
Branch: refs/heads/essingledocument
Commit: 545619225199cbe108584aafc18a1eca8847057f
Parents: 230870b ae9c9c0
Author: Todd Nine <to...@apache.org>
Authored: Thu Oct 2 17:52:30 2014 -0600
Committer: Todd Nine <to...@apache.org>
Committed: Thu Oct 2 17:52:30 2014 -0600
----------------------------------------------------------------------
.../collection/event/EntityDeleted.java | 17 +
.../collection/event/EntityVersionCreated.java | 17 +
.../collection/event/EntityVersionDeleted.java | 17 +
stack/corepersistence/map/pom.xml | 65 ++++
.../usergrid/persistence/map/MapManager.java | 69 ++++
.../persistence/map/MapManagerFactory.java | 30 ++
.../usergrid/persistence/map/MapScope.java | 40 +++
.../persistence/map/guice/MapModule.java | 61 ++++
.../persistence/map/impl/MapManagerImpl.java | 114 +++++++
.../persistence/map/impl/MapScopeImpl.java | 91 ++++++
.../persistence/map/impl/MapSerialization.java | 64 ++++
.../map/impl/MapSerializationImpl.java | 327 +++++++++++++++++++
.../persistence/map/MapManagerTest.java | 207 ++++++++++++
.../persistence/map/guice/TestMapModule.java | 16 +
stack/corepersistence/pom.xml | 1 +
.../services/notifications/QueueListener.java | 6 +-
16 files changed, 1141 insertions(+), 1 deletion(-)
----------------------------------------------------------------------