commit | 8a0f4dd73431257c0ab18c4c902eef84fe38e248 | [log] [tgz] |
---|---|---|
author | Ray Milkey <ray@opennetworking.org> | Wed Mar 07 09:09:10 2018 -0800 |
committer | Ray Milkey <ray@opennetworking.org> | Wed Mar 07 17:29:30 2018 +0000 |
tree | 4c30990b954d63013d6b9d910ce9fb7dbf93384b | |
parent | f192610f6ec29928d4bfc8b4698ab5c5428eb582 [diff] |
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 {