docs: @Override
      public RuntimeCapabilityRegistration removeCapability(String capabilityName, CapabilityScope scope,
                                                            PathAddress registrationPoint) {
          writeLock.lock();
          try {
              CapabilityId capabilityId = new CapabilityId(capabilityName, scope);
              RuntimeCapabilityRegistration removed = null;
              RuntimeCapabilityRegistration candidate = capabilities.get(capabilityId);
              if (candidate != null) {
                  RegistrationPoint rp = new RegistrationPoint(registrationPoint, null);
                  if (candidate.removeRegistrationPoint(rp)) {
  
                      Map<String, RuntimeRequirementRegistration> removedRequirements = null;
                      if (candidate.getRegistrationPointCount() == 0) {
                          removed = capabilities.remove(capabilityId);
                          removedRequirements = requirements.remove(capabilityId);
                          runtimeOnlyRequirements.remove(capabilityId);
                      } else {
                          // There are still registration points for this capability.
                          // So just remove the requirements for this registration point
                          Map<String, RuntimeRequirementRegistration> candidateRequirements = requirements.get(capabilityId);
                          if (candidateRequirements != null) {
                              removedRequirements = new HashMap<>(candidateRequirements.size());
                              // Iterate over array to avoid ConcurrentModificationException
                              for (String req : candidateRequirements.keySet().toArray(new String[candidateRequirements.size()])) {
                                  RuntimeRequirementRegistration removedReqReg = removeRequirement(new RuntimeRequirementRegistration(req, capabilityName, scope, rp), false);
                                  if (removedReqReg != null) {
                                      removedRequirements.put(req, removedReqReg);
                                  }
                              }
                          }
                          candidateRequirements = runtimeOnlyRequirements.get(capabilityId);
                          if (candidateRequirements != null) {
                              // Iterate over array to avoid ConcurrentModificationException
                              for (String req : candidateRequirements.keySet().toArray(new String[candidateRequirements.size()])) {
                                  removeRequirement(new RuntimeRequirementRegistration(req, capabilityName, scope, rp), true);
                              }
                          }
                      }
  
                      // Remember this removed cap for use by getRuntimeStatus until we are published or rolled back
                      RuntimeCapabilityRegistration removeReg = pendingRemoveCapabilities.get(capabilityId);
                      if (removeReg == null) {
                          removeReg = new RuntimeCapabilityRegistration(candidate.getCapability(), candidate.getCapabilityScope(), rp);
                          pendingRemoveCapabilities.put(capabilityId, removeReg);
                      } else {
                          removeReg.addRegistrationPoint(rp);
                      }
                      if (removedRequirements != null) {
                          pendingRemoveRequirements.put(capabilityId, removedRequirements);
                      }
  
                  }
              }
  
              if (removed != null) {
                  modified = true;
              }
              return removed;
          } finally {
              writeLock.unlock();
          }
      }