@Override public <R extends Service> void stopService(ServiceBinding<R> binding) { final Service service = binding.getService(); if (Stoppable.class.isInstance(service)) { try { ((Stoppable) service).stop(); } catch (Exception e) { LOG.unableToStopService(service.getClass(), e.toString()); } } }
public void destroy() { ListIterator<Service> serviceIterator = serviceList.listIterator(serviceList.size()); while (serviceIterator.hasPrevious()) { final Service service = serviceIterator.previous(); if (Stoppable.class.isInstance(service)) { try { ((Stoppable) service).stop(); } catch (Exception e) { LOG.unableToStopService(service.getClass(), e.toString()); } } } serviceList.clear(); serviceList = null; serviceBindingMap.clear(); serviceBindingMap = null; }