Example #1
0
  /** @since 3.1 */
  @Override
  protected void attachToChannel(DataChannel channel) {

    super.attachToChannel(channel);

    if (mergeHandler != null) {
      mergeHandler.setActive(false);
      mergeHandler = null;
    }

    EventManager eventManager = channel.getEventManager();

    if (eventManager != null) {
      mergeHandler = new DataContextMergeHandler(this);

      // listen to our channel events...
      // note that we must reset listener on channel switch, as there is
      // no
      // guarantee that a new channel uses the same EventManager.
      EventUtil.listenForChannelEvents(channel, mergeHandler);
    }

    if (!usingSharedSnaphsotCache && getObjectStore() != null) {
      DataRowStore cache = getObjectStore().getDataRowCache();

      if (cache != null) {
        cache.setEventManager(eventManager);
      }
    }
  }