diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/protocols/DpnP4Communicator.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/protocols/DpnP4Communicator.java
index b2e6062..15f3eb3 100644
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/protocols/DpnP4Communicator.java
+++ b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/protocols/DpnP4Communicator.java
@@ -51,6 +51,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
@@ -100,14 +101,16 @@
     // FIXME: should use a cache with timeout
     private static final Map<Long, Lock> SESS_LOCKS = Maps.newConcurrentMap();
 
+    private static final AtomicBoolean DEACTIVATED = new AtomicBoolean(true);
+
     private static DpnP4Communicator _instance;
 
     private final ApplicationId appId;
     private DeviceId deviceId;
     private ClientIdentifier clientId;
-    private final FlowRuleService flowRuleService;
-    private final RouteStore routeStore;
-    private final InterfaceAdminService interfaceService;
+    private FlowRuleService flowRuleService;
+    private RouteStore routeStore;
+    private InterfaceAdminService interfaceService;
 
     private DpnP4Communicator(ApplicationId appId,
                               FlowRuleService flowRuleService,
@@ -123,10 +126,13 @@
     public static DpnP4Communicator createInstance(
             ApplicationId appId, FlowRuleService flowRuleService,
             RouteStore routeStore, InterfaceAdminService interfaceService) {
-        if (_instance == null) {
-            _instance = new DpnP4Communicator(appId, flowRuleService, routeStore, interfaceService);
+        synchronized (DEACTIVATED) {
+            if (_instance == null) {
+                _instance = new DpnP4Communicator(appId, flowRuleService, routeStore, interfaceService);
+            }
+            DEACTIVATED.set(false);
+            return _instance;
         }
-        return _instance;
     }
 
     public static DpnP4Communicator getInstance() {
@@ -141,12 +147,25 @@
         this.clientId = clientId;
     }
 
+    public void deactivate() {
+        synchronized (DEACTIVATED) {
+            flowRuleService.removeFlowRulesById(appId);
+            DEACTIVATED.set(true);
+        }
+    }
+
     private boolean isNotInit() {
-        if (deviceId == null) {
-            log.error("Not initialized. Cannot perform operations.");
-            return true;
-        } else {
-            return false;
+        synchronized (DEACTIVATED) {
+            if (DEACTIVATED.get()) {
+                log.error("DEACTIVATED. Cannot perform operations.");
+                return false;
+            }
+            if (deviceId == null) {
+                log.error("Not initialized. Cannot perform operations.");
+                return true;
+            } else {
+                return false;
+            }
         }
     }
 
@@ -369,24 +388,36 @@
     }
 
     private void applySession(long sessionId) {
-        if (FLOWS.containsKey(sessionId)) {
-            batchApplyFlowRules(FLOWS.get(sessionId));
-        }
-        if (ROUTES.containsKey(sessionId)) {
-            ROUTES.get(sessionId).forEach(routeStore::updateRoute);
+        synchronized (DEACTIVATED) {
+            if (DEACTIVATED.get()) {
+                log.warn("DEACTIVATED. Cannot perform applySession()");
+                return;
+            }
+            if (FLOWS.containsKey(sessionId)) {
+                batchApplyFlowRules(FLOWS.get(sessionId));
+            }
+            if (ROUTES.containsKey(sessionId)) {
+                ROUTES.get(sessionId).forEach(routeStore::updateRoute);
+            }
         }
     }
 
     private void cleanUpSession(long sessionId) {
-        if (FLOWS.containsKey(sessionId)) {
-            batchRemoveFlowRules(FLOWS.get(sessionId));
-            FLOWS.get(sessionId).clear();
+        synchronized (DEACTIVATED) {
+            if (DEACTIVATED.get()) {
+                log.warn("DEACTIVATED. Cannot perform cleanUpSession()");
+                return;
+            }
+            if (FLOWS.containsKey(sessionId)) {
+                batchRemoveFlowRules(FLOWS.get(sessionId));
+                FLOWS.get(sessionId).clear();
+            }
+            if (ROUTES.containsKey(sessionId)) {
+                ROUTES.get(sessionId).forEach(routeStore::removeRoute);
+                ROUTES.get(sessionId).clear();
+            }
+            UE_ADDRESSES.remove(sessionId);
         }
-        if (ROUTES.containsKey(sessionId)) {
-            ROUTES.get(sessionId).forEach(routeStore::removeRoute);
-            ROUTES.get(sessionId).clear();
-        }
-        UE_ADDRESSES.remove(sessionId);
     }
 
     private void logSessionState(long sessionId) {
