/*
(non-Javadoc)

@see
com.technophobia.substeps.runner.GlossaryPublisher#publish(java.util.
List)
170980
public void publish(final List<StepImplementationsDescriptor> stepimplementationDescriptors) {
        final Map<String, List<StepDescriptor>> sectionSorted = new TreeMap<String, List<StepDescriptor>>();

        for (final StepImplementationsDescriptor descriptor : stepimplementationDescriptors) {

            for (final StepDescriptor stepTag : descriptor.getExpressions()) {

                String section = stepTag.getSection();
                if (section == null || section.isEmpty()) {
                    section = "Miscellaneous";
                }

                List<StepDescriptor> subList = sectionSorted.get(section);

                if (subList == null) {
                    subList = new ArrayList<StepDescriptor>();
                    sectionSorted.put(section, subList);
                }
                subList.add(stepTag);
            }
        }

        final String html = buildHtml(sectionSorted);

        outputFile.delete();

        // write out
        try {
            if (outputFile.createNewFile()) {
                Files.write(html, outputFile, Charset.defaultCharset());
            } else {
                // TODO
            }
        } catch (final IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
574263
public void publish(Event event) {
        logger.debug("Dispatching event: " + event.getClass().toString());
        final ArrayList<Class<? extends Subscriber>> subscriberClasses = subscriptionMap.get(event.getClass());
        if (subscriberClasses == null) {
            logger.debug("No subscribers to inform from event: " + event.getClass().getName());
            return;
        }
        for (Class<? extends Subscriber> clazz: subscriberClasses) {
            logger.debug("Alerting subscriber " + clazz.getName());

            if (event instanceof ChainableEvent) {
                addTrackedEvent((ChainableEvent)event);
            }

            // Check to see if the Event is Unblocked. If so, use a separate executor pool from normal events
            final ExecutorService executorService = event instanceof UnblockedEvent  ? dynamicExecutor : executor;

            executorService.execute(() -> {
                try (AlpineQueryManager qm = new AlpineQueryManager()) {
                    final EventServiceLog eventServiceLog = qm.createEventServiceLog(clazz);
                    final Subscriber subscriber = clazz.getDeclaredConstructor().newInstance();
                    subscriber.inform(event);
                    qm.updateEventServiceLog(eventServiceLog);
                    if (event instanceof ChainableEvent) {
                        ChainableEvent chainableEvent = (ChainableEvent)event;
                        logger.debug("Calling onSuccess");
                        for (ChainLink chainLink: chainableEvent.onSuccess()) {
                            if (chainLink.getSuccessEventService() != null) {
                                Method method = chainLink.getSuccessEventService().getMethod("getInstance");
                                IEventService es = (IEventService) method.invoke(chainLink.getSuccessEventService(), new Object[0]);
                                es.publish(chainLink.getSuccessEvent());
                            } else {
                                Event.dispatch(chainLink.getSuccessEvent());
                            }
                        }
                    }
                } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException | SecurityException e) {
                    logger.error("An error occurred while informing subscriber: " + e);
                    if (event instanceof ChainableEvent) {
                        ChainableEvent chainableEvent = (ChainableEvent)event;
                        logger.debug("Calling onFailure");
                        for (ChainLink chainLink: chainableEvent.onFailure()) {
                            if (chainLink.getFailureEventService() != null) {
                                try {
                                    Method method = chainLink.getFailureEventService().getMethod("getInstance");
                                    IEventService es = (IEventService) method.invoke(chainLink.getFailureEventService(), new Object[0]);
                                    es.publish(chainLink.getFailureEvent());
                                } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) {
                                    logger.error("Exception while calling onFailure callback", ex);
                                }
                            } else {
                                Event.dispatch(chainLink.getFailureEvent());
                            }
                        }
                    }
                }

                if (event instanceof ChainableEvent) {
                    removeTrackedEvent((ChainableEvent)event);
                }

            });
        }
    }
1209552
private void publishEndedEvent() {
        BatchEventsPublisher publisher = getBatchEventsPublisher();
        if (publisher != null) {

            publisher.publishSplitFlowEvent(getSplitName(),
                                            getFlowName(),
                                            getTopLevelInstanceId(),
                                            getTopLevelExecutionId(),
                                            BatchEventsPublisher.TOPIC_EXECUTION_SPLIT_FLOW_ENDED,
                                            correlationId);
        }
    }
367589
private void commitDataset(Collection<TaskState> taskStates, DataPublisher publisher) {

    try {
      publisher.publish(taskStates);
    } catch (Throwable t) {
      log.error("Failed to commit dataset", t);
      setTaskFailureException(taskStates, t);
    }
  }
32247
public void publish(byte[] message, EventBus bus) {
        bus.publish(getBinaryWriteHandlerId(), Buffer.buffer(message));
    }
43003
public Server onpublish(Action<Map<String, Object>> action) {
    publishActions.add(action);
    return this;
  }
456291
void publish() {

        I_CmsUpdateListener<String> updateListener = new I_CmsUpdateListener<String>() {

            @Override
            public void onUpdate(List<String> updatedItems) {

                updateItems(updatedItems);
            }
        };
        CmsAppWorkplaceUi.get().disableGlobalShortcuts();
        CmsGwtDialogExtension extension = new CmsGwtDialogExtension(A_CmsUI.get(), updateListener);
        extension.openPublishDialog(getPublishResources());
    }
1008130
@Override
  public <T> T publish(Class<T> beanType, Object id, Transaction transaction) {
    methodCalls.add(MethodCall.of(PUBLISH).with("beanType", beanType).with("id", id));
    return !persistPublish ? null : publish.publish(beanType, id, transaction);
  }
1266907
def publish(self, key, data):
        '''
        
        '''
        publish_data = {key: data}
        pub = salt.utils.json.dumps(publish_data) + str('\n\n')  # future lint: disable=blacklisted-function
        self.handler.write_message(pub)
793053
@Override
	public void publish(Event event) {

		// Check state
		if (status.get() == STATUS_STOPPED) {
			return;
		}

		// Connected
		if (event instanceof ConnectedEvent) {
			if (status.compareAndSet(STATUS_CONNECTING, STATUS_CONNECTED)) {

				// Redis connection is Ok
				logger.info("Redis get-set connection are estabilished.");
			}
			return;
		}

		// Disconnected
		if (event instanceof DisconnectedEvent) {
			int s = status.getAndSet(STATUS_DISCONNECTED);
			if (s != STATUS_DISCONNECTED) {
				logger.info("Redis get-set connection aborted.");
				reconnect();
			}
		}

	}
243937
private void publish(Cache<K, V> cache, EventType eventType,
      K key, @Nullable V oldValue, @Nullable V newValue, boolean quiet) {
    if (dispatchQueues.isEmpty()) {
      return;
    }

    JCacheEntryEvent<K, V> event = null;
    for (Registration<K, V> registration : dispatchQueues.keySet()) {
      if (!registration.getCacheEntryListener().isCompatible(eventType)) {
        continue;
      }
      if (event == null) {
        event = new JCacheEntryEvent<>(cache, eventType, key, oldValue, newValue);
      }
      if (!registration.getCacheEntryFilter().evaluate(event)) {
        continue;
      }

      JCacheEntryEvent<K, V> e = event;
      CompletableFuture<Void> future =
          dispatchQueues.computeIfPresent(registration, (k, queue) -> {
            Runnable action = () -> registration.getCacheEntryListener().dispatch(e);
            return queue.thenRunAsync(action, executor);
          });
      if ((future != null) && registration.isSynchronous() && !quiet) {
        pending.get().add(future);
      }
    }
  }
788079
public void publishRemoved(Cache<K, V> cache, K key, V value) {
    publish(cache, EventType.REMOVED, key, /* oldValue */ null, value, /* quiet */ false);
  }
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();
        }
    }
890511
@Override
  public void publish(final LogRecord record) {
    if (record == null) {
      return;
    }

    if (!isLoggable(record)) {
      return;
    }

    synchronized (this) {
      this.logs.add(record);
      if (!this.driverInitialized || this.logs.size() < BUFFER_LEN) {
        return;
      }
    }

    logAll();
  }
147805
@Override
    public <KEY> boolean publish(Collection<MethodDescriptor<KEY>> descs) {
        if (CollectionUtil.isEmpty(descs)) {
            LOG.warn("No service to publish");
            return false;
        }

        List<String> methodNames = CollectionUtil.transform(descs,
                new Function<MethodDescriptor<KEY>, String>() {
                    @Override
                    public String apply(MethodDescriptor<KEY> input) {
                        return String.format("%s.%s(..)", input.getInterfClass().getSimpleName(),
                                input.getMethod().getName());
                    }
                });

        List<String> serviceNames = CollectionUtil.transform(descs,
                new Function<MethodDescriptor<KEY>, String>() {

                    @Override
                    public String apply(MethodDescriptor<KEY> input) {
                        return input.getInterfClass().getSimpleName();
                    }

                });

        Set<String> distinctServices = new HashSet<String>(serviceNames);

        Collections.sort(methodNames);
        Collections.sort(serviceNames);
        if (LOG.isDebugEnabled()) {
            LOG.debug("Export rpc service methods which may include unneccessary methods: "
                    + Arrays.toString(methodNames.toArray(new String[] {})));
            LOG.debug("Export total " + methodNames.size() + " rpc service methods");
        }
        LOG.info("Export rpc services: "
                + Arrays.toString(distinctServices.toArray(new String[] {})));
        LOG.info("Export total " + distinctServices.size() + " rpc services");

        if (!RpcServerConf.ENABLE_ZK_REGISTRY) {
            LOG.info("Export services soley at localhost NOT register at zookeeper");
            return false;
        }

        if (!doConnectAndCreateZkPath()) {
            LOG.info("Export services failed at zookeeper and exit publishing");
            return false;
        }

        String localIp = ZkRegisterInfoUtil.getLocalHostIp();
        String localHostname = ZkRegisterInfoUtil.getLocalHostName();

        // override configuration files' port
        RpcServerConf.SERVER_PORT = Integer.valueOf(ZkRegisterInfoUtil.getLocalHostPort());

        List<String> failedRegistryServiceList = CollectionUtil.createArrayList();
        for (String service : distinctServices) {
            String zkPath = ZkPathUtil.buildPath(NaviCommonConstant.ZOOKEEPER_BASE_PATH,
                    RpcServerConf.ZK_REGISTRY_NAMESPACE, service, localIp + ":"
                            + RpcServerConf.SERVER_PORT);
            try {
                if (zkClient.exists(zkPath) != null) {
                    zkClient.delete(zkPath);
                }
                zkClient.createSessionNodeForRecursive(zkPath, localHostname.getBytes());
                LOG.info("Service registers at Zookeeper successfully - " + zkPath);
            } catch (NoNodeException e) {
                LOG.warn("Zookeeper path cannot found - " + zkPath);
            } catch (NodeExistsException e) {
                LOG.warn("Zookeeper path is already exists - " + zkPath);
            } catch (Exception e) {
                LOG.error("Zookeeper create path failed for " + zkPath, e);
                failedRegistryServiceList.add(zkPath);
            }
        }

        if (CollectionUtil.isEmpty(failedRegistryServiceList)) {
            LOG.info("Registry all " + (distinctServices.size() - failedRegistryServiceList.size())
                    + " services to zookeeper successfully");
        } else {
            LOG.info("Registry services to zookeeper encounter some problems, the failure registry paths are "
                    + Arrays.toString(failedRegistryServiceList.toArray(new String[] {})));
        }

        LOG.info("Publish for the " + republishCount.incrementAndGet() + " times");
        return true;
    }
1373458
public void publish(LogRecord record)
  {
    if (! isLoggable(record))
      return;
    
    int level = getLevel().intValue();

    for (int i = 0; i < _handlers.length; i++) {
      Handler handler = _handlers[i];

      if (level <= handler.getLevel().intValue())
        handler.publish(record);
    }
  }
76877
@Override
    public void publish(final Interaction.Execution<?, ?> execution) {

        final InteractionDto interactionDto = InteractionDtoUtils.newInteractionDto(execution);

        persist(execution);

        sendUsingJms(interactionDto);
    }