/*
Process the event generated when the node for a truncation request
is created, reschedules it for a few seconds later
511664
private void processTruncationRequestEvent(final WatchedEvent event) {
        if (event.getType() == EventType.NodeChildrenChanged) {
            boolean isBare = (!m_BareProcessed.getAndSet(true) && VoltDB.instance().isBare());
            int truncationGatheringPeriod = (isBare ? 0 : m_truncationGatheringPeriod);
            loggingLog.info("Scheduling truncation request processing " + truncationGatheringPeriod + " seconds from now");
            /*
             * Do it 10 seconds later because these requests tend to come in bunches
             * and we want one truncation snapshot to do truncation for all nodes
             * so we don't get them back to back
             *
             * TRAIL [TruncSnap:5] wait 10 secs to process request
             * If Bare take the truncation snapshot now.
             */
            m_es.schedule(new Runnable() {
                @Override
                public void run() {
                    try {
                        processSnapshotTruncationRequestCreated(event);
                    } catch (Exception e) {
                        VoltDB.crashLocalVoltDB("Error processing snapshot truncation request creation", true, e);
                    }
                }
            }, truncationGatheringPeriod, TimeUnit.SECONDS);
            return;
        } else {
            /*
             * We are very careful to cancel the watch if we find that a truncation requests exists. We are
             * the only thread and daemon that should delete the node or change the data and the watch
             * isn't set when that happens because it is part of processing the request and the watch should
             * either be canceled or have already fired.
             */
            VoltDB.crashLocalVoltDB(
                    "Trunction request watcher fired with event type other then created: " + event.getType(),
                    true,
                    null);
        }
    }
708352
@Override
    public void process(Object event) throws Exception {
        int secOffset = TimeUtils.secOffset();
        if (secOffset < UPLOAD_TIME_OFFSET_SEC) {
            JStormUtils.sleepMs((UPLOAD_TIME_OFFSET_SEC - secOffset) * 1000);
        } else if (secOffset == UPLOAD_TIME_OFFSET_SEC) {
            // do nothing
        } else {
            JStormUtils.sleepMs((60 - secOffset + UPLOAD_TIME_OFFSET_SEC) * 1000);
        }
        if (topologyMetricContext.getUploadedWorkerNum() > 0) {
            metricLogger.info("force upload metrics.");
            mergeAndUploadMetrics();
        }
    }
559979
function truncate(target, maxHeight) {
        if (!maxHeight) {
          return;
        }

        /**
         * Resets global variables.
         */
        function reset() {
          splitOnChars = opt.splitOnChars.slice(0);
          splitChar = splitOnChars[0];
          chunks = null;
          lastChunk = null;
        }

        var nodeValue = target.nodeValue.replace(opt.truncationChar, '');

        //Grab the next chunks
        if (!chunks) {
          //If there are more characters to try, grab the next one
          if (splitOnChars.length > 0) {
            splitChar = splitOnChars.shift();
          }
          //No characters to chunk by. Go character-by-character
          else {
            splitChar = '';
          }

          chunks = nodeValue.split(splitChar);
        }

        //If there are chunks left to remove, remove the last one and see if
        // the nodeValue fits.
        if (chunks.length > 1) {
          // console.log('chunks', chunks);
          lastChunk = chunks.pop();
          // console.log('lastChunk', lastChunk);
          applyEllipsis(target, chunks.join(splitChar));
        }
        //No more chunks can be removed using this character
        else {
          chunks = null;
        }

        //Insert the custom HTML before the truncation character
        if (truncationHTMLContainer) {
          target.nodeValue = target.nodeValue.replace(opt.truncationChar, '');
          element.innerHTML = target.nodeValue + ' ' + truncationHTMLContainer.innerHTML + opt.truncationChar;
        }

        //Search produced valid chunks
        if (chunks) {
          //It fits
          if (element.clientHeight <= maxHeight) {
            //There's still more characters to try splitting on, not quite done yet
            if (splitOnChars.length >= 0 && splitChar !== '') {
              applyEllipsis(target, chunks.join(splitChar) + splitChar + lastChunk);
              chunks = null;
            }
            //Finished!
            else {
              return element.innerHTML;
            }
          }
        }
        //No valid chunks produced
        else {
          //No valid chunks even when splitting by letter, time to move
          //on to the next node
          if (splitChar === '') {
            applyEllipsis(target, '');
            target = getLastChild(element);

            reset();
          }
        }

        //If you get here it means still too big, let's keep truncating
        if (opt.animate) {
          setTimeout(function() {
            truncate(target, maxHeight);
          }, opt.animate === true ? 10 : opt.animate);
        } else {
          return truncate(target, maxHeight);
        }
      }
283136
@Override
	public void processEvent(SystemEvent event) throws AbortProcessingException {
		if (!FacesContext.getCurrentInstance().isPostback()) {
			// if (!(getParent() instanceof Column)) {
			insertLabelBeforeThisInputField();
			insertMessageBehindThisInputField();
		}
		// }
	}
582479
function(element, event, callback) {

    const eventStack = ChuiEventCache.elements[element.id]
    if (!eventStack) return
    let deleteOrder = []

    if (!event) {
      deleteOrder = []
      eventStack.forEach(function(evt, idx) {
        element.removeEventListener(evt.event, evt.callback, evt.capturePhase)
        deleteOrder.push(idx)
      })

      deleteFromEventStack(deleteOrder, eventStack)

    } else if (!!event && !callback) {
      deleteOrder = []
      eventStack.forEach(function(evt, idx) {
        if (evt.event === event) {
          element.removeEventListener(evt.event, evt.callback, evt.capturePhase)
          deleteOrder.push(idx)
        }
      })

      deleteFromEventStack(deleteOrder, eventStack)

    } else if (callback) {
      deleteOrder = []
      eventStack.forEach(function(evt, idx) {
        if (callback === evt.callback) {
          element.removeEventListener(evt.event, evt.callback, evt.capturePhase)
          deleteOrder.push(idx)
        }
      })
      deleteFromEventStack(deleteOrder, eventStack)
    }
  }
1191547
def process(event, watch_type = nil)
      @zk.raw_event_handler(event)

      logger.debug { "EventHandler#process dispatching event for #{watch_type.inspect}: #{event.inspect}" }# unless event.type == -1
      event.zk = @zk

      cb_keys = 
        if event.node_event?
          [event.path, ALL_NODE_EVENTS_KEY]
        elsif event.session_event?
          [state_key(event.state), ALL_STATE_EVENTS_KEY]
        else
          raise ZKError, "don't know how to process event: #{event.inspect}"
        end

      cb_ary = synchronize do 
        clear_watch_restrictions(event, watch_type)

        @callbacks.values_at(*cb_keys)
      end

      cb_ary.flatten! # takes care of not modifying original arrays
      cb_ary.compact!

      # we only filter for node events
      if event.node_event?
        interest_key = event.interest_key
        cb_ary.select! { |sub| sub.interests.include?(interest_key) }
      end

      safe_call(cb_ary, event)
    end
1337076
public static void processTreeRequest(String treeId, TreeElement treeRoot, HttpServletRequest request, HttpServletResponse response)
    {
        assert(treeId != null) : "parameter treeId must not be null.";
        assert(treeRoot != null) : "parameter treeRoot must not be null.";
        assert(request != null) : "paramater request must not be null.";

        // check the root node to see if it is a TreeRootElement.  if it is, then we
        // use it to change the selected node.  Otherwise we will do a recursive search
        // of the tree to select the node.
        String selectNode = request.getParameter(TreeElement.SELECTED_NODE);
        if (selectNode != null) {
            if (treeRoot instanceof ITreeRootElement) {
                ITreeRootElement root = (ITreeRootElement) treeRoot;
                root.changeSelected(selectNode, request);
            }
            else {
                setSelected(treeRoot, selectNode, request);
            }
        }

        // handle auto expand.
        String expandNode = null;

        // our we auto expanding this node?
        expandNode = request.getParameter(TreeElement.EXPAND_NODE);

        // if we are auto expanding flip the expand of this node if it was expanded
        if (expandNode != null) {
            TreeElement n = treeRoot.findNode(expandNode);
            if (n != null) {
                n.onExpand(request, response);
                n.setExpanded(!n.isExpanded());
            }
        }
    }
194546
function _onChildNodeCountUpdated(event, res) {
        // res = {nodeId, childNodeCount}
        if (res.nodeId > 0) {
            Inspector.DOM.requestChildNodes(res.nodeId);
        }
    }
140529
function truncateNestedNodeStart($element, $rootNode, $clipNode, options) {
    var element = $element[0];

    var $children = $element.contents();
    var $child, child;

    var length = $children.length;
    var index = length -1;
    var truncated = false;

    $element.empty();

    for (; index >= 0 && !truncated; index--) {

      $child = $children.eq(index);
      child = $child[0];

      if (child.nodeType === 8) { // comment node
        continue;
      }

      element.insertBefore(child, element.firstChild);

      if ($clipNode.length) {
        if ($.inArray(element.tagName.toLowerCase(), BLOCK_TAGS) >= 0) {
          // Certain elements like <li> should not be appended to.
          $element.after($clipNode);
        } else {
          $element.append($clipNode);
        }
      }

      if ($rootNode.height() > options.maxHeight) {
        if (child.nodeType === 3) { // text node
          truncated = truncateTextContent($child, $rootNode, $clipNode, options);
        } else {
          truncated = truncateNestedNode($child, $rootNode, $clipNode, options);
        }
      }

      if (!truncated && $clipNode.length) {
        $clipNode.remove();
      }

    }

    return truncated;
  }
1059392
function () {

        // get a event from the front of queue
        var tmdata = queue.dequeue();

        // whether to keep processing (default is no)
        busy = false;

        // check if data exists
        if (tmdata === undefined) {
            return;
        }

        // handle the event if handler is available
        if (handler === null) {
            console.log(SR.Tags.ERR + 'handler undefined, cannot process event' + ERREND);
            return;
        }
                        
        switch (handler(tmdata)) {

            // if the event is not handled, re-queue it
            case false:
                queue.enqueue(tmdata);
                break;
                
            // return true, keep processing
            case true:
                break;
            
            /*
            // NOTE: we do not pause continuing execution, because it's possible for a event
            //         to consider it finished, re-activate the queue (which it think it has paused), 
            //       but then the execution runs to the end of handler, and returning a undefine to pause icQueue
            //       this will thus cause a event to indefinitely pause without any on-going progress.
            //
            //         Currently if the event has returned, we assume it's been processed. 
            //         If not yet, then it's up to the handler to re-enqueue the event (by returning 'false')
            //       note that it's possible that the previous event is still being processed 
            //       (for example, waiting for DB to return), while the next event starts processing
            //       so the ordering may not be preserved.
            //       The assumption we have is that events are relatively independent from each other
            //       so such out-of-sequence processing may be "okay," as long as handler will properly re-queue the event
            //       in case it needs to be processed again
            // 
            */

            // did not return anything, pause execution
            default:
                //console.log(SR.Tags.WARN + 'pause processing event, callee: ' + arguments.callee.name);
                return;
                break;                
        }            
        
        // keep processing
        busy = true;
        UTIL.asyncCall(processEvent);
    }
432810
@Initialize(distributed = false)
    public void truncateIfNecesary() {
        if (truncateTable) {
            final UpdateableDatastoreConnection con = datastore.openConnection();
            try {
                final SchemaNavigator schemaNavigator = con.getSchemaNavigator();

                final Table table = schemaNavigator.convertToTable(schemaName, tableName);

                final UpdateableDataContext dc = con.getUpdateableDataContext();
                dc.executeUpdate(new UpdateScript() {
                    @Override
                    public void run(UpdateCallback callback) {
                        final RowDeletionBuilder delete = callback.deleteFrom(table);
                        if (logger.isInfoEnabled()) {
                            logger.info("Executing truncating DELETE operation: {}", delete.toSql());
                        }
                        delete.execute();
                    }
                });
            } finally {
                con.close();
            }
        }
    }
836516
@MainThread
    private void handleEventPost(Event event) {
        Utils.log(event.getKey(), "Handling posted event");

        int sizeBefore = executionQueue.size();

        scheduleStatusUpdates(event, EventStatus.STARTED);
        scheduleSubscribersInvocation(event);

        if (((EventBase) event).handlersCount == 0) {
            Utils.log(event.getKey(), "No subscribers found");
            // Removing all scheduled STARTED status callbacks
            while (executionQueue.size() > sizeBefore) {
                executionQueue.removeLast();
            }
        } else {
            activeEvents.add(event);
            executeTasks(false);
        }
    }
594097
function(eventData) {
    initialResolve = true;
    // Cancel no event timer.
    if (noEventTimer) {
      noEventTimer.cancel();
    }
    // Incoming link detected.
    // Check for any stored partial event.
    self.getPartialStoredEvent_().then(function(event) {
      // Initialize to an unknown event.
      var authEvent = noEvent;
      // Confirm OAuth response included.
      if (event && eventData && eventData['url']) {
        // Construct complete event. Default to unknown event if none found.
        authEvent = self.extractAuthEventFromUrl_(event, eventData['url']) ||
            noEvent;
      }
      // Dispatch Auth event.
      self.dispatchEvent_(authEvent);
    });
  }
1300096
function updateEvent(event) { // update an existing event
		var i, len = cache.length, e,
			defaultEventEnd = getView().defaultEventEnd, // getView???
			startDelta = event.start - event._start,
			endDelta = event.end ?
				(event.end - (event._end || defaultEventEnd(event))) // event._end would be null if event.end
				: 0;                                                      // was null and event was just resized
		for (i=0; i<len; i++) {
			e = cache[i];
			if (e._id == event._id && e != event) {
				e.start = new Date(+e.start + startDelta);
				if (event.end) {
					if (e.end) {
						e.end = new Date(+e.end + endDelta);
					}else{
						e.end = new Date(+defaultEventEnd(e) + endDelta);
					}
				}else{
					e.end = null;
				}
				e.title = event.title;
				e.url = event.url;
				e.allDay = event.allDay;
				e.className = event.className;
				e.editable = event.editable;
				e.color = event.color;
				e.backgroundColor = event.backgroundColor;
				e.borderColor = event.borderColor;
				e.textColor = event.textColor;
				normalizeEvent(e);
			}
		}
		normalizeEvent(event);
		reportEvents(cache);
	}
804670
private void processNodeStateEvent(NodeStateEvent event) {
    switch (stateRef.get()) {
      case BEFORE_INIT:
      case DURING_INIT:
        throw new AssertionError("Filter should not be marked ready until LBP init");
      case CLOSING:
        return; // ignore
      case RUNNING:
        for (LoadBalancingPolicy policy : policies) {
          if (event.newState == NodeState.UP) {
            policy.onUp(event.node);
          } else if (event.newState == NodeState.DOWN || event.newState == NodeState.FORCED_DOWN) {
            policy.onDown(event.node);
          } else if (event.newState == NodeState.UNKNOWN) {
            policy.onAdd(event.node);
          } else if (event.newState == null) {
            policy.onRemove(event.node);
          } else {
            LOG.warn("[{}] Unsupported event: {}", logPrefix, event);
          }
        }
        break;
    }
  }
724428
function processNode(node) {
            const entity = node.code.trim()
            if (!entity) {
                context.report({
                    node,
                    messageId: "missing",
                })
            }
        }
280130
@Override
    public void handleEvent(Event event) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(this, tc, "Received event: " + event.getTopic());
        }
        // if (event.getTopic().equals(PURGE_EVENT)) {
        this.sessionMgr.startPurge();
        // }
    }