Fixed a defect where remotely-induced feature install was trying to stomp over locally -induced feature install.

Change-Id: I1cb2c2dd3da03a34b80b1db312056b44cc9c1f9f
diff --git a/core/net/src/main/java/org/onosproject/app/impl/ApplicationManager.java b/core/net/src/main/java/org/onosproject/app/impl/ApplicationManager.java
index 1d38215..5668578 100644
--- a/core/net/src/main/java/org/onosproject/app/impl/ApplicationManager.java
+++ b/core/net/src/main/java/org/onosproject/app/impl/ApplicationManager.java
@@ -189,19 +189,22 @@
         }
     }
 
-    private void installAppArtifacts(Application app) throws Exception {
+    // The following methods are fully synchronized to guard against remote vs.
+    // locally induced feature service interactions.
+
+    private synchronized void installAppArtifacts(Application app) throws Exception {
         if (app.featuresRepo().isPresent()) {
             featuresService.addRepository(app.featuresRepo().get());
         }
     }
 
-    private void uninstallAppArtifacts(Application app) throws Exception {
+    private synchronized void uninstallAppArtifacts(Application app) throws Exception {
         if (app.featuresRepo().isPresent()) {
             featuresService.removeRepository(app.featuresRepo().get());
         }
     }
 
-    private void installAppFeatures(Application app) throws Exception {
+    private synchronized void installAppFeatures(Application app) throws Exception {
         for (String name : app.features()) {
             Feature feature = featuresService.getFeature(name);
             if (!featuresService.isInstalled(feature)) {
@@ -210,7 +213,7 @@
         }
     }
 
-    private void uninstallAppFeatures(Application app) throws Exception {
+    private synchronized void uninstallAppFeatures(Application app) throws Exception {
         for (String name : app.features()) {
             Feature feature = featuresService.getFeature(name);
             if (featuresService.isInstalled(feature)) {