public static Object getCoordination(final Object object) { final Coordinator coordinator = (Coordinator) object; final Coordination threadCoordination = coordinator.peek(); if ( threadCoordination == null ) { try { return coordinator.create("org.apache.felix.configurator", 0L); } catch (final Exception e) { SystemLogger.error("Unable to create new coordination with coordinator " + coordinator, e); } } return null; }
Coordination getTopCoordination() { Coordination coordination = coordinator.peek(); while (coordination != null && coordination.getEnclosingCoordination() != null) { coordination = coordination.getEnclosingCoordination(); } return coordination; }
public static boolean addToCoordination(final Object srv, final UpdateThread thread, final Runnable task) { final Coordinator coordinator = (Coordinator) srv; Coordination c = coordinator.peek(); if ( c != null ) { Notifier n = null; for(final Participant p : c.getParticipants()) { if ( p instanceof Notifier ) { n = (Notifier) p; break; } } if ( n == null ) { n = new Notifier(thread); c.addParticipant(n); } n.add(task); return true; } return false; } }
public static boolean addToCoordination(final Object srv, final UpdateThread thread, final Runnable task) { final Coordinator coordinator = (Coordinator) srv; Coordination c = coordinator.peek(); if ( c != null ) { Notifier n = null; for(final Participant p : c.getParticipants()) { if ( p instanceof Notifier ) { n = (Notifier) p; break; } } if ( n == null ) { n = new Notifier(thread); c.addParticipant(n); } n.add(task); return true; } return false; } }