@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); } } }
@Override public synchronized boolean installContribution(Contribution contrib) { RegistrationInfo ri; try { ri = ctx.deploy(contrib); } catch (IOException e) { throw new RuntimeServiceException(e); } if (ri == null) { return false; } ri.setPersistent(true); return true; }
protected void notifyComponentsOnStarted() throws Exception { for (RegistrationInfo ri : manager.getRegistrations()) { ri.notifyApplicationStarted(); } }