Prevent ConfigPusher from killing its thread
[controller.git] / opendaylight / connectionmanager / implementation / src / main / java / org / opendaylight / controller / connectionmanager / scheme / SingleControllerScheme.java
1 package org.opendaylight.controller.connectionmanager.scheme;
2
3 import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
4 import org.opendaylight.controller.connectionmanager.ConnectionMgmtScheme;
5 import org.opendaylight.controller.sal.core.Node;
6
7 class SingleControllerScheme extends AbstractScheme {
8
9     private static AbstractScheme myScheme = null;
10
11     protected SingleControllerScheme(IClusterGlobalServices clusterServices) {
12         super(clusterServices, ConnectionMgmtScheme.SINGLE_CONTROLLER);
13     }
14
15     public static AbstractScheme getScheme(IClusterGlobalServices clusterServices) {
16         if (myScheme == null) {
17             myScheme = new SingleControllerScheme(clusterServices);
18         }
19         return myScheme;
20     }
21
22     @Override
23     public boolean isConnectionAllowedInternal(Node node) {
24         // Lets make it simple. The Cluster Coordinator is the master
25         return clusterServices.amICoordinator();
26     }
27 }