package org.opendaylight.controller.config.persist.impl;
import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.common.base.Function;
import com.google.common.base.Stopwatch;
import com.google.common.collect.Collections2;
import java.io.IOException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;
import javax.management.MBeanServerConnection;
import org.opendaylight.controller.config.api.ConflictingVersionException;
}
static Set<String> transformCapabilities(final Set<Capability> currentCapabilities) {
- return new HashSet<>(Collections2.transform(currentCapabilities, new Function<Capability, String>() {
- @Override
- public String apply(@Nonnull final Capability input) {
- return input.getCapabilityUri();
- }
- }));
+ return new HashSet<>(Collections2.transform(currentCapabilities, Capability::getCapabilityUri));
}
static class ConfigPusherException extends Exception {
LOG.debug("Configuration Persister got {}", service);
LOG.debug("Context was {}", context);
LOG.debug("Registration was {}", registration);
- final Thread pushingThread = new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- if(configs != null && !configs.isEmpty()) {
- configPusher.pushConfigs(configs);
- }
- if(context != null) {
- registration = context.registerService(ConfigPusher.class.getName(), configPusher, null);
- configPusher.process(autoCloseables, platformMBeanServer, persisterAggregator, false);
- } else {
- LOG.warn("Unable to process configs as BundleContext is null");
- }
- } catch (final InterruptedException e) {
- LOG.info("ConfigPusher thread stopped");
- }
- LOG.info("Configuration Persister initialization completed.");
+ final Thread pushingThread = new Thread(() -> {
+ try {
+ if(configs != null && !configs.isEmpty()) {
+ configPusher.pushConfigs(configs);
}
- }, "config-pusher");
- synchronized (autoCloseables) {
- autoCloseables.add(new AutoCloseable() {
- @Override
- public void close() {
- pushingThread.interrupt();
+ if(context != null) {
+ registration = context.registerService(ConfigPusher.class.getName(), configPusher, null);
+ configPusher.process(autoCloseables, platformMBeanServer, persisterAggregator, false);
+ } else {
+ LOG.warn("Unable to process configs as BundleContext is null");
}
- });
+ } catch (final InterruptedException e) {
+ LOG.info("ConfigPusher thread stopped");
+ }
+ LOG.info("Configuration Persister initialization completed.");
+ }, "config-pusher");
+ synchronized (autoCloseables) {
+ autoCloseables.add(() -> pushingThread.interrupt());
}
pushingThread.setDaemon(true);
pushingThread.start();