ServiceReferenceRegistryImpl.createInitialSRLookupRegistry();
// constructor
- public ConfigRegistryImpl(ModuleFactoriesResolver resolver,
- MBeanServer configMBeanServer, BindingContextProvider bindingContextProvider) {
+ public ConfigRegistryImpl(final ModuleFactoriesResolver resolver,
+ final MBeanServer configMBeanServer, final BindingContextProvider bindingContextProvider) {
this(resolver, configMBeanServer,
new BaseJMXRegistrator(configMBeanServer), bindingContextProvider);
}
// constructor
- public ConfigRegistryImpl(ModuleFactoriesResolver resolver,
- MBeanServer configMBeanServer,
- BaseJMXRegistrator baseJMXRegistrator, BindingContextProvider bindingContextProvider) {
+ public ConfigRegistryImpl(final ModuleFactoriesResolver resolver,
+ final MBeanServer configMBeanServer,
+ final BaseJMXRegistrator baseJMXRegistrator, final BindingContextProvider bindingContextProvider) {
this.resolver = resolver;
this.beanToOsgiServiceManager = new BeanToOsgiServiceManager();
this.configMBeanServer = configMBeanServer;
* @param blankTransaction true if this transaction is created automatically by
* org.opendaylight.controller.config.manager.impl.osgi.BlankTransactionServiceTracker
*/
- public ObjectName beginConfig(boolean blankTransaction) {
+ public ObjectName beginConfig(final boolean blankTransaction) {
// If we're closed or in the process of closing then all modules are destroyed or being destroyed
// so there's no point in trying to acquire the lock and beginning an actual transaction. Also we want
// to avoid trying to lock as it may block the shutdown process if there is an outstanding transaction
LOG.debug("Timed out trying to obtain configTransactionLock");
return NOOP_TX_NAME;
}
- } catch(InterruptedException e) {
+ } catch(final InterruptedException e) {
LOG.debug("Interrupted trying to obtain configTransactionLock", e);
Thread.currentThread().interrupt();
return NOOP_TX_NAME;
}
@GuardedBy("configTransactionLock")
- private ConfigTransactionControllerInternal beginConfigSafe(boolean blankTransaction) {
+ private ConfigTransactionControllerInternal beginConfigSafe(final boolean blankTransaction) {
versionCounter++;
final String transactionName = "ConfigTransaction-" + version + "-" + versionCounter;
configMBeanServer, blankTransaction, writableRegistry);
try {
txLookupRegistry.registerMBean(transactionController, transactionController.getControllerObjectName());
- } catch (InstanceAlreadyExistsException e) {
+ } catch (final InstanceAlreadyExistsException e) {
throw new IllegalStateException(e);
}
transactionController.copyExistingModulesAndProcessFactoryDiff(currentConfig.getEntries(), lastListOfFactories);
* @throws ConflictingVersionException
*/
@Override
- public CommitStatus commitConfig(ObjectName transactionControllerON)
+ public CommitStatus commitConfig(final ObjectName transactionControllerON)
throws ValidationException, ConflictingVersionException {
if(NOOP_TX_NAME.equals(transactionControllerON) || closed.get()) {
return new CommitStatus(Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
}
@GuardedBy("configTransactionLock")
- private CommitStatus commitConfigSafe(ObjectName transactionControllerON)
+ private CommitStatus commitConfigSafe(final ObjectName transactionControllerON)
throws ConflictingVersionException, ValidationException {
final String transactionName = ObjectNameUtil
.getTransactionName(transactionControllerON);
return secondPhaseCommit(configTransactionController, commitInfo, configTransactionControllerEntry.getValue());
// some libs throw Errors: e.g.
// javax.xml.ws.spi.FactoryFinder$ConfigurationError
- } catch (Throwable t) {
+ } catch (final Throwable t) {
isHealthy = false;
LOG.error("Configuration Transaction failed on 2PC, server is unhealthy", t);
throw Throwables.propagate(t);
}
@GuardedBy("configTransactionLock")
- private CommitStatus secondPhaseCommit(ConfigTransactionControllerInternal configTransactionController,
- CommitInfo commitInfo, ConfigTransactionLookupRegistry txLookupRegistry) {
+ private CommitStatus secondPhaseCommit(final ConfigTransactionControllerInternal configTransactionController,
+ final CommitInfo commitInfo, final ConfigTransactionLookupRegistry txLookupRegistry) {
// close instances which were destroyed by the user, including
// (hopefully) runtime beans
// register to JMX
try {
newModuleJMXRegistrator.registerMBean(newReadableConfigBean, primaryReadOnlyON);
- } catch (InstanceAlreadyExistsException e) {
+ } catch (final InstanceAlreadyExistsException e) {
throw new IllegalStateException("Possible code error, already registered:" + primaryReadOnlyON,e);
}
try {
configTransactionControllerEntry.getValue().close();
configTransactionController.abortConfig();
- } catch (RuntimeException e) {
+ } catch (final RuntimeException e) {
LOG.debug("Ignoring exception while aborting {}", configTransactionController, e);
}
}
* {@inheritDoc}
*/
@Override
- public Set<ObjectName> lookupConfigBeans(String moduleName) {
+ public Set<ObjectName> lookupConfigBeans(final String moduleName) {
return lookupConfigBeans(moduleName, "*");
}
* {@inheritDoc}
*/
@Override
- public ObjectName lookupConfigBean(String moduleName, String instanceName)
+ public ObjectName lookupConfigBean(final String moduleName, final String instanceName)
throws InstanceNotFoundException {
return LookupBeansUtil.lookupConfigBean(this, moduleName, instanceName);
}
* {@inheritDoc}
*/
@Override
- public Set<ObjectName> lookupConfigBeans(String moduleName,
- String instanceName) {
+ public Set<ObjectName> lookupConfigBeans(final String moduleName,
+ final String instanceName) {
ObjectName namePattern = ObjectNameUtil.createModulePattern(moduleName,
instanceName);
return baseJMXRegistrator.queryNames(namePattern, null);
* {@inheritDoc}
*/
@Override
- public Set<ObjectName> lookupRuntimeBeans(String moduleName,
- String instanceName) {
+ public Set<ObjectName> lookupRuntimeBeans(final String moduleName,
+ final String instanceName) {
String finalModuleName = moduleName == null ? "*" : moduleName;
String finalInstanceName = instanceName == null ? "*" : instanceName;
ObjectName namePattern = ObjectNameUtil.createRuntimeBeanPattern(
}
@Override
- public void checkConfigBeanExists(ObjectName objectName) throws InstanceNotFoundException {
+ public void checkConfigBeanExists(final ObjectName objectName) throws InstanceNotFoundException {
ObjectNameUtil.checkDomain(objectName);
ObjectNameUtil.checkType(objectName, ObjectNameUtil.TYPE_MODULE);
String transactionName = ObjectNameUtil.getTransactionName(objectName);
// service reference functionality:
@Override
- public ObjectName lookupConfigBeanByServiceInterfaceName(String serviceInterfaceQName, String refName) {
+ public ObjectName lookupConfigBeanByServiceInterfaceName(final String serviceInterfaceQName, final String refName) {
synchronized(readableSRRegistryLock) {
return readableSRRegistry.lookupConfigBeanByServiceInterfaceName(serviceInterfaceQName, refName);
}
}
@Override
- public Map<String, ObjectName> lookupServiceReferencesByServiceInterfaceName(String serviceInterfaceQName) {
+ public Map<String, ObjectName> lookupServiceReferencesByServiceInterfaceName(final String serviceInterfaceQName) {
synchronized(readableSRRegistryLock) {
return readableSRRegistry.lookupServiceReferencesByServiceInterfaceName(serviceInterfaceQName);
}
}
@Override
- public Set<String> lookupServiceInterfaceNames(ObjectName objectName) throws InstanceNotFoundException {
+ public Set<String> lookupServiceInterfaceNames(final ObjectName objectName) throws InstanceNotFoundException {
synchronized(readableSRRegistryLock) {
return readableSRRegistry.lookupServiceInterfaceNames(objectName);
}
}
@Override
- public String getServiceInterfaceName(String namespace, String localName) {
+ public String getServiceInterfaceName(final String namespace, final String localName) {
synchronized(readableSRRegistryLock) {
return readableSRRegistry.getServiceInterfaceName(namespace, localName);
}
}
@Override
- public void checkServiceReferenceExists(ObjectName objectName) throws InstanceNotFoundException {
+ public void checkServiceReferenceExists(final ObjectName objectName) throws InstanceNotFoundException {
synchronized(readableSRRegistryLock) {
readableSRRegistry.checkServiceReferenceExists(objectName);
}
}
@Override
- public ObjectName getServiceReference(String serviceInterfaceQName, String refName) throws InstanceNotFoundException {
+ public ObjectName getServiceReference(final String serviceInterfaceQName, final String refName) throws InstanceNotFoundException {
synchronized(readableSRRegistryLock) {
return readableSRRegistry.getServiceReference(serviceInterfaceQName, refName);
}
* Add all modules to the internal map. Also add service instance to OSGi
* Service Registry.
*/
- public void addAll(Collection<ModuleInternalInfo> configInfos) {
+ public void addAll(final Collection<ModuleInternalInfo> configInfos) {
if (!currentConfig.isEmpty()) {
throw new IllegalStateException(
"Error - some config entries were not removed: "
}
}
- private void add(ModuleInternalInfo configInfo) {
+ private void add(final ModuleInternalInfo configInfo) {
ModuleInternalInfo oldValue = currentConfig.putIfAbsent(configInfo.getIdentifier(), configInfo);
if (oldValue != null) {
throw new IllegalStateException(
/**
* Remove entry from current config.
*/
- public void remove(ModuleIdentifier name) {
+ public void remove(final ModuleIdentifier name) {
ModuleInternalInfo removed = currentConfig.remove(name);
if (removed == null) {
throw new IllegalStateException(
private final ConcurrentMap<String /* transactionName */,
Entry<ConfigTransactionControllerInternal, ConfigTransactionLookupRegistry>> transactions = new ConcurrentHashMap<>();
- public void add(String transactionName,
- ConfigTransactionControllerInternal transactionController, ConfigTransactionLookupRegistry txLookupRegistry) {
+ public void add(final String transactionName,
+ final ConfigTransactionControllerInternal transactionController, final ConfigTransactionLookupRegistry txLookupRegistry) {
Object oldValue = transactions.putIfAbsent(transactionName,
Maps.immutableEntry(transactionController, txLookupRegistry));
if (oldValue != null) {