@Override
public void modifiedService(ServiceReference<BindingAwareBroker> reference, BindingAwareBroker service) {
- // TODO Auto-generated method stub
-
+ removedService(reference, service);
+ addingService(reference);
}
@Override
public void removedService(ServiceReference<BindingAwareBroker> reference, BindingAwareBroker service) {
- // TODO Auto-generated method stub
+ broker = context.getService(reference);
+ mdActivationPool.execute(new Runnable() {
+ @Override
+ public void run() {
+ onBrokerRemoved(broker, context);
+ }
+ });
}
};
protected abstract void onBrokerAvailable(BindingAwareBroker broker, BundleContext context);
protected void onBrokerRemoved(BindingAwareBroker broker, BundleContext context) {
-
+ stopImpl(context);
}
}
dataChangeListenerRegistration.close();
rpcRegistration.close();
runtimeReg.close();
- opendaylightToaster.close();
+ closeQuietly(opendaylightToaster);
log.info("Toaster provider (instance {}) torn down.", this);
}
+
+ private void closeQuietly(final AutoCloseable resource) {
+ try {
+ resource.close();
+ } catch (final Exception e) {
+ log.debug("Ignoring exception while closing {}", resource, e);
+ }
+ }
}
AutoCloseable ret = new AutoCloseableToaster();
final NetconfDocumentedException sendErrorException) {
try {
final Element incommingRpc = incommingDocument.getDocumentElement();
- Preconditions.checkState(incommingRpc.getTagName().equals(XmlNetconfConstants.RPC_KEY), "Missing "
- + XmlNetconfConstants.RPC_KEY + " " + "element");
+ Preconditions.checkState(incommingRpc.getTagName().equals(XmlNetconfConstants.RPC_KEY), "Missing %s element",
+ XmlNetconfConstants.RPC_KEY);
final Element rpcReply = errorDocument.getDocumentElement();
- Preconditions.checkState(rpcReply.getTagName().equals(XmlNetconfConstants.RPC_REPLY_KEY), "Missing "
- + XmlNetconfConstants.RPC_REPLY_KEY + " element");
+ Preconditions.checkState(rpcReply.getTagName().equals(XmlNetconfConstants.RPC_REPLY_KEY), "Missing %s element",
+ XmlNetconfConstants.RPC_REPLY_KEY);
final NamedNodeMap incomingAttributes = incommingRpc.getAttributes();
for (int i = 0; i < incomingAttributes.getLength(); i++) {
@Override
public void operationComplete(final ChannelFuture channelFuture) throws Exception {
- Preconditions.checkState(channelFuture.isSuccess(), "Unable to send exception {}", sendErrorException,
+ Preconditions.checkState(channelFuture.isSuccess(), "Unable to send exception %s", sendErrorException,
channelFuture.cause());
}
}