Synchronizing BGP thrift service delete context.
[netvirt.git] / bgpmanager / impl / src / main / java / org / opendaylight / netvirt / bgpmanager / thrift / server / BgpThriftService.java
index 9f52b1f98fcd2caf461cd4e98a590b2b5530c098..1a82205edb8f8f0b9b30889aafb1f3f4fa5f9b3c 100644 (file)
@@ -111,12 +111,14 @@ public class BgpThriftService {
 
                     @Override
                     public void deleteContext(ServerContext serverContext, TProtocol input, TProtocol output) {
-                        LOG.info("Bgp thrift server delete context event");
-                        if (oldThriftClientContext == serverContext) {
-                            LOG.info("Bgp thrift server cleanup old context");
-                            oldThriftClientContext = null;
-                        } else {
-                            LOG.info("Bgp thrift server cleanup context");
+                        synchronized (this) {
+                            LOG.info("Bgp thrift server delete context event");
+                            if (oldThriftClientContext == serverContext) {
+                                LOG.info("Bgp thrift server cleanup old context");
+                                oldThriftClientContext = null;
+                            } else {
+                                LOG.info("Bgp thrift server cleanup context");
+                            }
                         }
                     }