ONOS-6955
onos-app does not reinstall apps correctly

Change-Id: I79e5172769d2aecc50ecdcbe60a86f49a5c17fef
diff --git a/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java b/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
index 7145a12..a2c652a 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
@@ -515,8 +515,8 @@
                 }
                 setupApplicationAndNotify(appId, newApp.app(), newApp.state());
             } else if (event.type() == MapEvent.Type.REMOVE) {
-                notifyDelegate(new ApplicationEvent(APP_UNINSTALLED, oldApp.app()));
                 purgeApplication(appId.name());
+                notifyDelegate(new ApplicationEvent(APP_UNINSTALLED, oldApp.app()));
             }
         }
     }