You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/04/02 20:08:30 UTC

[1/3] incubator-usergrid git commit: fix for bad push notifications channel

Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o-dev 3c0a8a8d3 -> da8d7b6c9


fix for bad push notifications channel


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/20eef256
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/20eef256
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/20eef256

Branch: refs/heads/two-dot-o-dev
Commit: 20eef2565f3da56d5a97deefd4836ee791c36bff
Parents: 3c0a8a8
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Apr 2 08:44:26 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Apr 2 08:44:26 2015 -0600

----------------------------------------------------------------------
 .../services/notifications/apns/FailedConnectionListener.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/20eef256/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java
index 552701f..9e3552f 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java
@@ -23,6 +23,7 @@ import org.slf4j.LoggerFactory;
 
 import javax.net.ssl.SSLException;
 import javax.net.ssl.SSLHandshakeException;
+import java.nio.channels.ClosedChannelException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.BlockingQueue;
@@ -40,7 +41,7 @@ public class FailedConnectionListener implements com.relayrides.pushy.apns.Faile
     @Override
     public void handleFailedConnection(PushManager<? extends SimpleApnsPushNotification> pushManager, Throwable cause) {
         List<SimpleApnsPushNotification> notifications = new ArrayList<SimpleApnsPushNotification>();
-        if (cause instanceof SSLException || cause instanceof SSLHandshakeException) { //cert is probably bad so shut it down.
+        if (cause instanceof SSLException || cause instanceof SSLHandshakeException || cause instanceof ClosedChannelException) { //cert is probably bad so shut it down.
             if (!pushManager.isShutDown()) {
                 pushManager.unregisterFailedConnectionListener(this);
 


[3/3] incubator-usergrid git commit: remove recursive call to self

Posted by sf...@apache.org.
remove recursive call to self


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/da8d7b6c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/da8d7b6c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/da8d7b6c

Branch: refs/heads/two-dot-o-dev
Commit: da8d7b6c9bf76660d28629064e3396b72d9a800c
Parents: 90e2032
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Apr 2 12:08:22 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Apr 2 12:08:22 2015 -0600

----------------------------------------------------------------------
 .../src/test/java/org/apache/usergrid/CoreITSetupImpl.java  | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/da8d7b6c/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java b/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
index 26254b1..82e5486 100644
--- a/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
+++ b/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
@@ -162,6 +162,13 @@ public class CoreITSetupImpl implements CoreITSetup, TestEntityIndex {
         } catch (InterruptedException ie){
 
         }
-        getEntityIndex().refresh();
+
+        emf.refreshIndex();
+
+        try {
+            Thread.sleep(50);
+        } catch (InterruptedException ie){
+
+        }
     }
 }


[2/3] incubator-usergrid git commit: return exception instead of null; add better error trapping for apns

Posted by sf...@apache.org.
return exception instead of null;add better error trapping for apns


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/90e20320
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/90e20320
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/90e20320

Branch: refs/heads/two-dot-o-dev
Commit: 90e2032002df4e415ea9a3d4151a815f5101f4d3
Parents: 20eef25
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Apr 2 11:32:02 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Apr 2 11:32:02 2015 -0600

----------------------------------------------------------------------
 .../corepersistence/CpEntityManagerFactory.java |  8 +++---
 .../apns/FailedConnectionListener.java          | 28 ++++++++++----------
 2 files changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/90e20320/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index 07c0b40..4ffc92a 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@ -423,11 +423,13 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
 
         Map<String, UUID> appMap = new HashMap<>();
 
-        ApplicationScope appScope = CpNamingUtils.getApplicationScope( CpNamingUtils.SYSTEM_APP_ID );
-        GraphManager gm = managerCache.getGraphManager( appScope );
+        ApplicationScope appScope = CpNamingUtils.getApplicationScope(CpNamingUtils.SYSTEM_APP_ID);
+        GraphManager gm = managerCache.getGraphManager(appScope);
 
-        EntityManager em = getEntityManager( CpNamingUtils.SYSTEM_APP_ID );
+        EntityManager em = getEntityManager(CpNamingUtils.SYSTEM_APP_ID);
         Application app = em.getApplication();
+        if(app == null)
+            throw new RuntimeException("System App "+CpNamingUtils.SYSTEM_APP_ID+" should never be null");
         Id fromEntityId = new SimpleId( app.getUuid(), app.getType() );
 
         final String edgeType;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/90e20320/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java
index 9e3552f..817deab 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java
@@ -66,22 +66,22 @@ public class FailedConnectionListener implements com.relayrides.pushy.apns.Faile
         }
         //mark all unsent notifications failed
         if (notifications != null) {
-            for (SimpleApnsPushNotification notification : notifications) {
-                if (notification instanceof APNsNotification) {
-                    try {
-                        ((APNsNotification) notification).messageSendFailed(cause);//mark failed with bad token
-                    } catch (Exception e) {
-                        logger.error("failed to track notification in failed connection listener", e);
+                notifications.forEach(notification -> {
+                    if (notification instanceof APNsNotification) {
+                        try {
+                            ((APNsNotification) notification).messageSendFailed(cause);//mark failed with bad token
+                        } catch (Exception e) {
+                            logger.error("failed to track notification in failed connection listener", e);
+                        }
+                    }
+                    //if test this is a problem because you can't connect
+                    if (notification instanceof TestAPNsNotification) {
+                        TestAPNsNotification testAPNsNotification = ((TestAPNsNotification) notification);
+                        testAPNsNotification.setReason(cause);
+                        testAPNsNotification.countdown();
                     }
-                }
-                //if test this is a problem because you can't connect
-                if (notification instanceof TestAPNsNotification) {
-                    TestAPNsNotification testAPNsNotification = ((TestAPNsNotification) notification);
-                    testAPNsNotification.setReason(cause);
-                    testAPNsNotification.countdown();
-                }
 
-            }
+                });
             pushManager.getQueue().clear();
         }
         logger.error("Failed to register push connection", cause);