Skip to content

Commit

Permalink
Only report on directly missing deps
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Feb 14, 2018
1 parent ecb58ea commit a1fbc83
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.jboss.msc.service.ServiceContainer;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceRegistry;
import org.jboss.msc.service.StabilityMonitor;
import org.jboss.msc.service.StartException;

Expand Down Expand Up @@ -88,28 +89,31 @@ public synchronized void execute(final OperationContext context, final ModelNode
failedSet.add(serviceName);
failedList.get(serviceName.getCanonicalName()).set(getServiceFailureDescription(controller.getStartException()));
}

ServiceRegistry registry = context.getServiceRegistry(false);
// generate lists of problems and missing services
List<String> problemList = new ArrayList<>();
for (ServiceController<?> controller : problems) {
Set<ServiceName> immediatelyUnavailable = controller.getImmediateUnavailableDependencies();
if (!immediatelyUnavailable.isEmpty()) {
StringBuilder missing = new StringBuilder();
boolean direct = false;
for (Iterator<ServiceName> i = immediatelyUnavailable.iterator(); i.hasNext(); ) {
ServiceName missingSvc = i.next();
if (!failedSet.contains(missingSvc)) {
if (registry.getService(missingSvc) == null) {
unavailableServices.add(missingSvc);
}
missing.append(missingSvc.getCanonicalName());
if (i.hasNext()) {
missing.append(", ");
direct = true;
if (missing.length() != 0) {
missing.append(", ");
}
missing.append(missingSvc.getCanonicalName());
}
}

final StringBuilder problem = new StringBuilder();
problem.append(controller.getName().getCanonicalName());
problem.append(" ").append(ControllerLogger.ROOT_LOGGER.servicesMissing(missing));
problemList.add(problem.toString());
if(direct) {
final StringBuilder problem = new StringBuilder();
problem.append(controller.getName().getCanonicalName());
problem.append(" ").append(ControllerLogger.ROOT_LOGGER.servicesMissing(missing));
problemList.add(problem.toString());
}

} else {
if (missingTransitive == null) {
Expand Down

0 comments on commit a1fbc83

Please sign in to comment.