Fix unsafe synchronization on parameter variable

Change-Id: I636aaf597b215812c626aee3e6607c11f3e41a82
diff --git a/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/DefaultXmppDeviceFactory.java b/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/DefaultXmppDeviceFactory.java
index ae9f523..037be79 100644
--- a/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/DefaultXmppDeviceFactory.java
+++ b/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/DefaultXmppDeviceFactory.java
@@ -33,7 +33,8 @@
 
     private final Logger logger = getLogger(getClass());
 
-    protected XmppDeviceAgent agent;
+    private XmppDeviceAgent agent;
+    private final Object agentLock = new Object();
 
     public void init(XmppDeviceAgent manager) {
         setAgent(manager);
@@ -45,7 +46,7 @@
      * @param agent reference object of XMPP device manager
      */
     private void setAgent(XmppDeviceAgent agent) {
-        synchronized (agent) {
+        synchronized (agentLock) {
             if (this.agent == null) {
                 this.agent = agent;
             } else {
@@ -55,7 +56,7 @@
     }
 
     public void cleanAgent() {
-        synchronized (agent) {
+        synchronized (agentLock) {
             if (this.agent != null) {
                 this.agent = null;
             } else {