@Override public int compare(RegistrationInfo r1, RegistrationInfo r2) { int cmp = Integer.compare(r1.getApplicationStartedOrder(), r2.getApplicationStartedOrder()); if (cmp == 0) { // fallback on name order, to be deterministic cmp = r1.getName().getName().compareTo(r2.getName().getName()); } return cmp; }
protected void notifyComponentsOnStarted() { List<RegistrationInfo> ris = new ArrayList<>(manager.getRegistrations()); Collections.sort(ris, new RIApplicationStartedComparator()); for (RegistrationInfo ri : ris) { try { ri.notifyApplicationStarted(); } catch (RuntimeException e) { log.error("Failed to notify component '" + ri.getName() + "' on application started", e); } } }