/*-------------------------------------------------------------------------
Publish:
-------------------------------------------------------------------------
772145
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
    {
        $value = null;

        if (isset($data['value'])) {
            $value = (is_array($data['value']) ? self::__tagArrayToString($data['value']) : $data['value']);
        }

        $label = Widget::Label($this->get('label'));

        if ($this->get('required') !== 'yes') {
            $label->appendChild(new XMLElement('i', __('Optional')));
        }

        $label->appendChild(
            Widget::Input('fields'.$fieldnamePrefix.'['.$this->get('element_name').']'.$fieldnamePostfix, (strlen($value) != 0 ? General::sanitize($value) : null))
        );

        if ($flagWithError != null) {
            $wrapper->appendChild(Widget::Error($label, $flagWithError));
        } else {
            $wrapper->appendChild($label);
        }

        if ($this->get('pre_populate_source') != null) {
            $existing_tags = $this->getToggleStates();

            if (is_array($existing_tags) && !empty($existing_tags)) {
                $taglist = new XMLElement('ul');
                $taglist->setAttribute('class', 'tags');
                $taglist->setAttribute('data-interactive', 'data-interactive');

                foreach ($existing_tags as $tag) {
                    $taglist->appendChild(
                        new XMLElement('li', General::sanitize($tag))
                    );
                }

                $wrapper->appendChild($taglist);
            }
        }
    }
1195232
@SuppressWarnings("unchecked")
  private void handlePublish(PublishRequest request) {
    state.getLogger().trace("{} - Received {}", state.getSessionId(), request);

    // If the request is for another session ID, this may be a session that was previously opened
    // for this client.
    if (request.session() != state.getSessionId()) {
      state.getLogger().trace("{} - Inconsistent session ID: {}", state.getSessionId(), request.session());
      return;
    }

    // If the request event index has already been processed, return.
    if (request.eventIndex() <= state.getEventIndex()) {
      return;
    }

    // If the request's previous event index doesn't equal the previous received event index,
    // respond with an undefined error and the last index received. This will cause the cluster
    // to resend events starting at eventIndex + 1.
    if (request.previousIndex() != state.getEventIndex()) {
      state.getLogger().trace("{} - Inconsistent event index: {}", state.getSessionId(), request.previousIndex());
      connection.send(ResetRequest.builder()
        .withSession(state.getSessionId())
        .withIndex(state.getEventIndex())
        .build());
      return;
    }

    // Store the event index. This will be used to verify that events are received in sequential order.
    state.setEventIndex(request.eventIndex());

    sequencer.sequenceEvent(request, () -> {
      for (Event<?> event : request.events()) {
        Set<Consumer> listeners = eventListeners.get(event.name());
        if (listeners != null) {
          for (Consumer listener : listeners) {
            listener.accept(event.message());
          }
        }
      }
    });
  }
462146
protected void doPublishEvent(final ApplicationEvent e) {
        if (applicationEventPublisher != null) {
            LOGGER.trace("Publishing [{}]", e);
            this.applicationEventPublisher.publishEvent(e);
        }
    }
1039239
function validatePublishRules(uri, { val, errors }) {
  let err, errMsg;

  if (!val) {
    errMsg = `Error publishing page: ${replaceVersion(uri)}`;
    log('error', errMsg, { publishRuleErrors: errors });
    err = new Error(errMsg);
    err.status = 400;
    return bluebird.reject(err);
  }

  return val;
}
444301
public void publish(Object event) {
        Objects.requireNonNull(event, Required.EVENT.toString());
        
        this.eventBus.post(event);
        this.events.getAndIncrement();
    }
580724
public void publishCreated(Cache<K, V> cache, K key, V value) {
    publish(cache, EventType.CREATED, key, /* newValue */ null, value, /* quiet */ false);
  }
352405
public void publishTo(final K key, final Publisher<V> publisher) {
        registered.get(key).fromStream(Spouts.from(publisher));
    }
202746
def publish(self, topic, message):
        """"""
        self.connect()
        log.info('publish {}'.format(message))
        self.client.publish(topic, message)
132164
function publish(loc, data) {
  data = data || {};
  data.clientID = clientID;
  fayeClient.publish(loc, data);
}
579984
void publish() {
        assert publishedFullRegistry != null : "Cannot write directly to main registry";

        writeLock.lock();
        try {
            if (!modified) {
                return;
            }
            publishedFullRegistry.writeLock.lock();
            try {
                publishedFullRegistry.clear(true);
                copy(this, publishedFullRegistry);
                pendingRemoveCapabilities.clear();
                pendingRemoveRequirements.clear();
                modified = false;
            } finally {
                publishedFullRegistry.writeLock.unlock();
            }
        } finally {
            writeLock.unlock();
        }
    }
138302
function () {
    var projectPath = path.resolve(cwd, './__publish__');
    projectPublishRoot = projectPath;
    if (!fs.existsSync(path.resolve(cwd, './__publish__'))) {
        fs.mkdirSync(path.resolve(cwd, './__publish__'));
    }
    fs.mkdirSync(projectPath + '/styles');
    fs.mkdirSync(projectPath + '/scripts');
    fs.mkdirSync(projectPath + '/statics');

    pageToPublish.forEach(function (subPage) {
        var dirPath = getPageDir(subPage);
        if (!fs.existsSync(dirPath)) {
            shell.mkdir('-p', dirPath);
        }
    });
}
893909
def publish (self):
        '''
        
        '''
        #print(self)
        #self.using_event.wait()

        self.lock.acquire()
        msg = cmdvel2PosTarget(self.vel)
        self.lock.release()
        self.pub.publish(msg)
987551
function publish(conn, channel, indices, message) {
  var i
    , conn;
  for(i = 0;i < indices.length;i++) {
    conn = this._state.getClient(indices[i]);
    if(conn) {
      conn.write(message);
    }
  }
}
776899
public function setPublishing($publishing = null)
    {
        if ($publishing === null) {
            $this->_publishing = null;
        } else {
            $this->_publishing = $this->validatePublishing($publishing);
        }

        return $this;
    }
64092
public function publish()
    {
        if (empty($this->handlers)) {
            return false;
        }

        foreach ($this->handlers as $handler) {
            $handler->handle($this->eventData);
        }
        return true;
    }
1291909
function publishToNpm() {
        return new Promise(function(resolve, reject) {
          _spork('npm', ['publish'], done, _.partial(reject, new Error('failed to publish to npm')));

          function done() {
            if (!options.quiet) {
              gutil.log('Published to \'' + chalk.cyan('npm') + '\'');
            }

            resolve();
          }
        });
      }
836344
function PublishLog() {
  let state = {
    count: 0,
    messages: {},
    sequenceNumber: 0
  };

  /**
   * Gets the next sequence number
   * @private
   */
  const next = () => {
    state.count++;
    return (state.sequenceNumber++);
  };

  /**
   * Adds a message to the log
   * @public
   */
  const add = (m) => {
    let mSeq;
    if (!state.messages.sequenceNo) {
      mSeq = next(state);
      m.sequenceNo = mSeq;
      state.messages[mSeq] = m;
    }
  };

  /**
   * Removes a message from the log
   * @public
   */
  const remove = (m) => {
    let mSeq = m.sequenceNo !== undefined ? m.sequenceNo : m;
    if (state.messages[mSeq]) {
      delete state.messages[mSeq];
      state.count--;
      return true;
    }
    return false;
  };

  /**
   * Resets the log
   * @public
   */
  const reset = () => {
    let list = _.map(state.messages, function(m) {
      delete m.sequenceNo;
      return m;
    });
    state.sequenceNumber = 0;
    state.messages = {};
    state.count = 0;
    return list;
  };

  return {
    add: add,
    count: () => {
      return state.count;
    },
    reset: reset,
    remove: remove
  };
}