/** * Add knowledge of a role. * This is a build-time operation that is not synchronized, and * should be used while setting up the system state -before servicing * requests. * @param providerRole role to add * @return the role status built up * @throws BadConfigException if a role of that priority already exists */ public RoleStatus buildRole(ProviderRole providerRole) throws BadConfigException { // build role status map int priority = providerRole.id; if (roleStatusMap.containsKey(priority)) { throw new BadConfigException("Duplicate Provider Key: %s and %s", providerRole, roleStatusMap.get(priority)); } RoleStatus roleStatus = new RoleStatus(providerRole); roleStatusMap.put(priority, roleStatus); String name = providerRole.name; roles.put(name, providerRole); rolePriorityMap.put(priority, providerRole); // register its entries metricsAndMonitoring.addMetricSet(MetricsConstants.PREFIX_SLIDER_ROLES + name, roleStatus); return roleStatus; }
/** * Add knowledge of a role. * This is a build-time operation that is not synchronized, and * should be used while setting up the system state -before servicing * requests. * @param providerRole role to add * @return the role status built up * @throws BadConfigException if a role of that priority already exists */ public RoleStatus buildRole(ProviderRole providerRole) throws BadConfigException { // build role status map int priority = providerRole.id; if (roleStatusMap.containsKey(priority)) { throw new BadConfigException("Duplicate Provider Key: %s and %s", providerRole, roleStatusMap.get(priority)); } RoleStatus roleStatus = new RoleStatus(providerRole); roleStatusMap.put(priority, roleStatus); String name = providerRole.name; roles.put(name, providerRole); rolePriorityMap.put(priority, providerRole); // register its entries metricsAndMonitoring.addMetricSet(MetricsConstants.PREFIX_SLIDER_ROLES + name, roleStatus); return roleStatus; }