Search in sources :

Example 6 with ServiceReference

use of org.opendaylight.controller.config.manager.impl.jmx.ServiceReference in project controller by opendaylight.

the class ServiceReferenceRegistryImpl method checkServiceReferenceExists.

@Override
public synchronized void checkServiceReferenceExists(final ObjectName objectName) throws InstanceNotFoundException {
    String actualTransactionName = ObjectNameUtil.getTransactionName(objectName);
    String expectedTransactionName = serviceReferenceRegistrator.getNullableTransactionName();
    if (writable && actualTransactionName == null || writable && !actualTransactionName.equals(expectedTransactionName)) {
        throw new IllegalArgumentException("Mismatched transaction name in " + objectName);
    }
    String serviceQName = ObjectNameUtil.getServiceQName(objectName);
    String referenceName = ObjectNameUtil.getReferenceName(objectName);
    ServiceReference serviceReference = new ServiceReference(serviceQName, referenceName);
    if (!refNames.containsKey(serviceReference)) {
        LOG.warn("Cannot find {} in {}", serviceReference, refNames);
        throw new InstanceNotFoundException("Service reference not found:" + objectName);
    }
}
Also used : InstanceNotFoundException(javax.management.InstanceNotFoundException) ServiceReference(org.opendaylight.controller.config.manager.impl.jmx.ServiceReference)

Example 7 with ServiceReference

use of org.opendaylight.controller.config.manager.impl.jmx.ServiceReference in project controller by opendaylight.

the class ServiceReferenceRegistryImpl method removeServiceReferences.

private boolean removeServiceReferences(final ObjectName moduleObjectName, final Set<String> names) throws InstanceNotFoundException {
    ObjectNameUtil.checkType(moduleObjectName, ObjectNameUtil.TYPE_MODULE);
    assertWritable();
    Set<ServiceReference> serviceReferencesLinkingTo = findServiceReferencesLinkingTo(moduleObjectName, names);
    for (ServiceReference sr : serviceReferencesLinkingTo) {
        removeServiceReference(sr);
    }
    return !serviceReferencesLinkingTo.isEmpty();
}
Also used : ServiceReference(org.opendaylight.controller.config.manager.impl.jmx.ServiceReference)

Aggregations

ServiceReference (org.opendaylight.controller.config.manager.impl.jmx.ServiceReference)7 InstanceNotFoundException (javax.management.InstanceNotFoundException)2 ModuleIdentifier (org.opendaylight.controller.config.api.ModuleIdentifier)2 SimpleImmutableEntry (java.util.AbstractMap.SimpleImmutableEntry)1 HashSet (java.util.HashSet)1 Entry (java.util.Map.Entry)1 ObjectName (javax.management.ObjectName)1