public void unregisterService(long id) {
final ServiceRegistration registration = serviceRegistrations.remove(id);
if (registration == null) {
throw new IllegalStateException("Registration with id " + id + " has already been removed or has never been registered");
}
registration.unregister();
}
}