Committed by
Gerrit Code Review
Moving netconf connect devices to thread, fixing listener kickout
Change-Id: I75fc3fbc6e5e6da20683c3a8f0a06aae270c3c40
Showing
1 changed file
with
7 additions
and
1 deletions
| ... | @@ -53,7 +53,10 @@ import org.onosproject.netconf.NetconfException; | ... | @@ -53,7 +53,10 @@ import org.onosproject.netconf.NetconfException; |
| 53 | import org.slf4j.Logger; | 53 | import org.slf4j.Logger; |
| 54 | 54 | ||
| 55 | import java.io.IOException; | 55 | import java.io.IOException; |
| 56 | +import java.util.concurrent.ExecutorService; | ||
| 57 | +import java.util.concurrent.Executors; | ||
| 56 | 58 | ||
| 59 | +import static org.onlab.util.Tools.groupedThreads; | ||
| 57 | import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY; | 60 | import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY; |
| 58 | import static org.slf4j.LoggerFactory.getLogger; | 61 | import static org.slf4j.LoggerFactory.getLogger; |
| 59 | 62 | ||
| ... | @@ -88,6 +91,9 @@ public class NetconfDeviceProvider extends AbstractProvider | ... | @@ -88,6 +91,9 @@ public class NetconfDeviceProvider extends AbstractProvider |
| 88 | private static final String DEVICE_PROVIDER_PACKAGE = "org.onosproject.netconf.provider.device"; | 91 | private static final String DEVICE_PROVIDER_PACKAGE = "org.onosproject.netconf.provider.device"; |
| 89 | private static final String UNKNOWN = "unknown"; | 92 | private static final String UNKNOWN = "unknown"; |
| 90 | 93 | ||
| 94 | + private final ExecutorService executor = | ||
| 95 | + Executors.newFixedThreadPool(5, groupedThreads("onos/netconfdeviceprovider", "device-installer-%d")); | ||
| 96 | + | ||
| 91 | private DeviceProviderService providerService; | 97 | private DeviceProviderService providerService; |
| 92 | private NetconfDeviceListener innerNodeListener = new InnerNetconfDeviceListener(); | 98 | private NetconfDeviceListener innerNodeListener = new InnerNetconfDeviceListener(); |
| 93 | 99 | ||
| ... | @@ -229,7 +235,7 @@ public class NetconfDeviceProvider extends AbstractProvider | ... | @@ -229,7 +235,7 @@ public class NetconfDeviceProvider extends AbstractProvider |
| 229 | 235 | ||
| 230 | @Override | 236 | @Override |
| 231 | public void event(NetworkConfigEvent event) { | 237 | public void event(NetworkConfigEvent event) { |
| 232 | - connectDevices(); | 238 | + executor.submit(NetconfDeviceProvider.this::connectDevices); |
| 233 | } | 239 | } |
| 234 | 240 | ||
| 235 | @Override | 241 | @Override | ... | ... |
-
Please register or login to post a comment