ok.. got your point. I have reverted the code to the original code and made a change to the non-osgi plugin to use the closeRegistration method.