public void removedService(ServiceReference reference, Object service) { ServiceRegistration registration = (ServiceRegistration) service; registration.unregister(); context.ungetService(reference); logger.debug("service was unregistered"); try { ((TCPServer) subscriber).suspend(); } catch (Exception e) { e.printStackTrace(); } }