code: @Override
      public void registerCapability(RuntimeCapabilityRegistration capabilityRegistration) {
          writeLock.lock();
          try {
              CapabilityId capabilityId = capabilityRegistration.getCapabilityId();
              RegistrationPoint rp = capabilityRegistration.getOldestRegistrationPoint();
              RuntimeCapabilityRegistration currentRegistration = capabilities.get(capabilityId);
              if (currentRegistration != null) {
                  // The actual capability must be the same, the capability must allow multiple registrations
                  // and we must not already have a registration from this same resource
                  if (!Objects.equals(capabilityRegistration.getCapability(), currentRegistration.getCapability())
                          || !currentRegistration.getCapability().isAllowMultipleRegistrations()
                          || !currentRegistration.addRegistrationPoint(rp)) {
                      throw ControllerLogger.MGMT_OP_LOGGER.capabilityAlreadyRegisteredInContext(capabilityId.getName(),
                                  rp, capabilityId.getScope().getName(), currentRegistration.getRegistrationPoints());
                  }
                  // else it was ok, and we just recorded the additional registration point
              } else {
                  capabilities.put(capabilityId, capabilityRegistration);
              }
  
              // Add any hard requirements
              for (String req : capabilityRegistration.getCapability().getRequirements()) {
                  registerRequirement(new RuntimeRequirementRegistration(req, capabilityId.getName(),
                          capabilityId.getScope(), rp));
              }
  
              if (!forServer) {
                  CapabilityScope capContext = capabilityId.getScope();
                  knownContexts.add(capContext);
              }
              modified = true;
          } finally {
              writeLock.unlock();
          }
      }
docs: Registers a capability with the system. Any
  {@link org.jboss.as.controller.capability.Capability#getRequirements() requirements}
  associated with the capability will be recorded as requirements.
  
  @param capabilityRegistration the capability. Cannot be {@code null}