@edu.umd.cs.findbugs.annotations.SuppressWarnings( value = "RV_RETURN_VALUE_IGNORED", justification = "We don't care about return value from queue.poll(), queue is used as a barrier") public boolean await(long timeout, TimeUnit unit) { if (applicationFactory.getApplication() == null) { // We are probably in setup. Anyways, with no application Crowd Embedded will not work so we // assume // there is no synchronization currently occuring. return true; } long current = System.currentTimeMillis(); final long deadLine = System.currentTimeMillis() + unit.toMillis(timeout); publisher.register(this); try { boolean synchroniseRunning = isSynchroniseRunning(); while (synchroniseRunning && current < deadLine) { queue.poll(Math.min(pollingPeriod, deadLine - current), TimeUnit.MILLISECONDS); synchroniseRunning = isSynchroniseRunning(); current = System.currentTimeMillis(); } return !synchroniseRunning; } catch (InterruptedException e) { return !isSynchroniseRunning(); } finally { publisher.unregister(this); } }
@Override public void afterPropertiesSet() throws Exception { eventPublisher.register(this); }
@Override public void destroy() throws Exception { eventPublisher.unregister(this); }
public JiraLinkResolver(PluginAccessor pluginAccessor, EventPublisher eventPublisher) { this.linkResolverProvider = new LinkResolverProvider(pluginAccessor); eventPublisher.register(linkResolverProvider); }
@Override public void destroy() throws Exception { // --> unregister ourselves with the EventPublisher eventPublisher.unregister(this); }
@Override public void afterPropertiesSet() throws Exception { // --> register ourselves with the EventPublisher eventPublisher.register(this); }
private void publishShareEvent(final ShareService.ValidateShareSearchRequestResult result) { final AbstractShareEvent event = getProperEvent(result.getSearchRequest(), result.getShareBean(), result.getUser()); eventPublisher.publish(event); }