/** * @param channel * the channel name */ public JavaScriptChannelEvent(String channel) { super(channel); addData(KEY, getJavaScript()); }
public void publish(final ChannelEvent event) { publisher.publish(event); }
/** * {@inheritDoc} */ public T get() { if (service == null) service = lookupService(); return service; }
protected void onTimer(final AjaxRequestTarget target) if (isStopped()) getComponent().remove(this); return; final TimerPushService pushService = TimerPushService.get(target.getPage().getApplication()); pushService.onDisconnect(node); for (final IPushEventContext<?> ctx : (List<IPushEventContext<?>>)pushService.pollEvents(node)) try entry.getValue().onEvent(target, ctx.getEvent(), node, ctx);
protected void onTimer(final AjaxRequestTarget target) final TimerPushService pushService = TimerPushService.get(target.getPage().getApplication()); pushService.onDisconnect(node); for (final Iterator<TimerPushEventContext<?>> it = pushService.pollEvents(node) .iterator(); it.hasNext();) try entry.getValue().onEvent(target, ctx.getEvent(), node, ctx);
void onDisconnect(final TimerPushNode<?> node) { if (_nodeStates.remove(node) != null) { LOG.debug("Timer push node {} disconnected.", node); disconnectFromAllChannels(node); for (final IPushNodeDisconnectedListener listener : disconnectListeners) try { listener.onDisconnect(node); } catch (final RuntimeException ex) { LOG.error("Failed to notify " + listener, ex); } } }
/** * {@inheritDoc} */ @Override protected void respond(final AjaxRequestTarget target) { final CometdPushService pushService = CometdPushService.get(); // retrieve all collected events and process them for (final Entry<CometdPushNode, IPushEventHandler> entry : _handlers.entrySet()) { final CometdPushNode node = entry.getKey(); for (final Iterator<CometdPushEventContext<?>> it = pushService.pollEvents(node) .iterator(); it.hasNext();) { final CometdPushEventContext<?> ctx = it.next(); try { entry.getValue().onEvent(target, ctx.getEvent(), node, ctx); } catch (final RuntimeException ex) { LOG.error("Failed while processing event", ex); } } } } }
private void _onDisconnect(final CometdPushNode<?> node) { if (_nodeStates.remove(node) != null) { LOG.debug("Cometd push node {} disconnected.", node); disconnectFromAllChannels(node); for (final IPushNodeDisconnectedListener listener : _disconnectListeners) try { listener.onDisconnect(node); } catch (final RuntimeException ex) { LOG.error("Failed to notify " + listener, ex); } } }
public void add(final ChannelEvent value) { for (final EventStoreListener listener : listenerList) { listener.eventTriggered(value.getChannel(), value.getData()); } }
/** * {@inheritDoc} */ public <EventType> IPushChannel<EventType> createChannel(final String label) { final PushChannel<EventType> channel = new PushChannel<EventType>(label); nodesByChannels.put(channel, new CopyOnWriteArraySet<IPushNode<?>>()); return channel; }
void onDisconnect(final TimerPushNode<?> node) { if (_nodeStates.remove(node) != null) { LOG.debug("Timer push node {} disconnected.", node); disconnectFromAllChannels(node); for (final IPushNodeDisconnectedListener listener : _disconnectListeners) try { listener.onDisconnect(node); } catch (final RuntimeException ex) { LOG.error("Failed to notify " + listener, ex); } } }
/** * {@inheritDoc} */ public <EventType> IPushChannel<EventType> createChannel(final String label) { final PushChannel<EventType> channel = new PushChannel<EventType>(label); nodesByChannels.put(channel, new CopyOnWriteArraySet<IPushNode<?>>()); return channel; }