private void flushLazy(ServerMessage message) {
    synchronized (getLock()) {
      ServerChannel channel = _bayeux.getChannel(message.getChannel());
      long lazyTimeout = -1;
      if (channel != null) lazyTimeout = channel.getLazyTimeout();
      if (lazyTimeout <= 0) lazyTimeout = _maxLazy;

      if (lazyTimeout <= 0) flush();
      else _lazyTask.schedule(lazyTimeout);
    }
  }
  public void flush() {
    Scheduler scheduler;
    synchronized (getLock()) {
      _lazyTask.cancel();

      scheduler = _scheduler;

      if (scheduler != null) {
        if (scheduler instanceof AbstractHttpTransport.HttpScheduler) _scheduler = null;
      }
    }
    if (scheduler != null) {
      scheduler.schedule();
      // If there is a scheduler, then it's a remote session
      // and we should not perform local delivery, so we return
      return;
    }

    // do local delivery
    if (_localSession != null && hasNonLazyMessages()) {
      for (ServerMessage msg : takeQueue()) _localSession.receive(new HashMapMessage(msg));
    }
  }