/** * @see org.osgi.service.coordinator.Coordinator#addParticipant(org.osgi.service.coordinator.Participant) */ public boolean addParticipant(final Participant participant) { Coordination current = peek(); if (current != null) { current.addParticipant(participant); return true; } return false; }
public boolean addParticipant(Participant participant) throws CoordinationException { CoordinationWeakReference.processOrphanedCoordinations(); Coordination coordination = peek(); if (coordination == null) return false; coordination.addParticipant(participant); return true; }
@Override public Object preCall(ComponentMetadata cm, Method m, Object... parameters) throws Throwable { if (coordinator == null || em == null) { initServices(); } try { LOG.debug("PreCall for bean {}, method {}", cm.getId(), m.getName()); Coordination coordination = coordinator.begin("jpa", 0); boolean weControlTx = isResourceLocal(em) && !em.getTransaction().isActive(); if (weControlTx) { coordination.addParticipant(new ResourceLocalTransactionParticipant(em)); } return coordination; } catch (Exception e) { LOG.warn("Exception from EmSupplier.preCall", e); throw new RuntimeException(e); // NOSONAR } }
emSet.add(em); setEm(coordination, em); coordination.addParticipant(new EmShutDownParticipant());
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; } }