/*
Process the received event.
422517
public void processEvent(ContentEvent event, int counter) {
		if (this.piInstances == null || this.piInstances.size() < this.getParallelism())
			throw new IllegalStateException("ThreadsWorkerProcessingItem(s) need to be setup before process any event (i.e. in ThreadsTopology.start()).");
		
		ThreadsProcessingItemInstance piInstance = this.piInstances.get(counter);
		ThreadsEventRunnable runnable = new ThreadsEventRunnable(piInstance, event);
		ThreadsEngine.getThreadWithIndex(piInstance.getThreadIndex()).submit(runnable);
	}
424794
private void processUserSnapshotRequestEvent(final WatchedEvent event) throws Exception {
        if (event.getType() == EventType.NodeCreated) {
            byte data[] = m_zk.getData(event.getPath(), false, null);
            String jsonString = new String(data, "UTF-8");
            final JSONObject jsObj = new JSONObject(jsonString);
            final String requestId = jsObj.getString("requestId");
            final boolean blocking = jsObj.getBoolean(SnapshotUtil.JSON_BLOCK);
            /*
             * Going to reuse the request object, remove the requestId
             * field now that it is consumed
             */
            jsObj.remove("requestId");
            jsObj.put("perPartitionTxnIds", retrievePerPartitionTransactionIds());
            String nonce = jsObj.getString(SnapshotUtil.JSON_NONCE);
            final long handle = m_nextCallbackHandle++;
            m_procedureCallbacks.put(handle, new ProcedureCallback() {

                @Override
                public void clientCallback(ClientResponse clientResponse) {
                    m_lastInitiationTs = null;
                    try {
                        /*
                         * If there is an error then we are done.
                         */
                        if (clientResponse.getStatus() != ClientResponse.SUCCESS) {
                            ClientResponseImpl rimpl = (ClientResponseImpl)clientResponse;
                            saveResponseToZKAndReset(requestId, rimpl);
                            return;
                        }

                        /*
                         * Now analyze the response. If a snapshot was in progress
                         * we have to reattempt it later, and send a response to the client
                         * saying it was queued. Otherwise, forward the response
                         * failure/success to the client.
                         */
                        if (isSnapshotInProgressResponse(clientResponse)) {
                            loggingLog.info("Deferring user snapshot with nonce " + nonce + " until after in-progress snapshot completes");
                            scheduleSnapshotForLater(jsObj.toString(4), requestId, true);
                        } else {
                            ClientResponseImpl rimpl = (ClientResponseImpl)clientResponse;
                            saveResponseToZKAndReset(requestId, rimpl);
                            return;
                        }
                    } catch (Exception e) {
                        SNAP_LOG.error("Error processing user snapshot request", e);
                        try {
                            userSnapshotRequestExistenceCheck(true);
                        } catch (Exception e2) {
                            VoltDB.crashLocalVoltDB("Error resetting watch for user snapshots", true, e2);
                        }
                    }
                }
            });
            loggingLog.info("Initiating user snapshot with nonce " + nonce);
            initiateSnapshotSave(handle, new Object[]{jsObj.toString(4)}, blocking);
            return;
        }
    }
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();
        // }
    }
449241
def process_events
      while (event = @_actable.mailbox.obtain_and_shift)
        event_handler(event)
      end

    rescue Exception => exception
      cleanup_handler(exception)
      exception_handler(exception)
    ensure
      @_actable.mailbox.release do
        process_events
      end

      nil
    end
403723
private QYBaseRespMsg processEventHandle(QYBaseEvent event){
        if(CollectionUtil.isEmpty(eventHandles)){
            synchronized (LOCK){
                eventHandles = this.initEventHandles();
            }
        }
        if(CollectionUtil.isNotEmpty(eventHandles)){
            for(QYEventHandle eventHandle : eventHandles){
                QYBaseRespMsg resultMsg = null;
                boolean result;
                try{
                    result = eventHandle.beforeHandle(event);
                }catch (Exception e){
                    result = false;
                }
                if(result){
                    resultMsg = eventHandle.handle(event);
                }
                if(BeanUtil.nonNull(resultMsg)){
                    return resultMsg;
                }
            }
        }
        return null;
    }
1073743
protected final Event processEvent() throws IOException {
    while (true) {
      String line;
      try {
        line = readLine();
      } catch (final EOFException ex) {
        if (doneOnce) {
          throw ex;
        }
        doneOnce = true;
        line = "";
      }

      // If the line is empty (a blank line), Dispatch the event, as defined below.
      if (line.isEmpty()) {
        // If the data buffer is an empty string, set the data buffer and the event name buffer to
        // the empty string and abort these steps.
        if (dataBuffer.length() == 0) {
          eventName = "";
          continue;
        }

        // If the event name buffer is not the empty string but is also not a valid NCName,
        // set the data buffer and the event name buffer to the empty string and abort these steps.
        // NOT IMPLEMENTED

        final Event.Builder eventBuilder = new Event.Builder();
        eventBuilder.withEventName(eventName.isEmpty() ? Event.MESSAGE_EVENT : eventName);
        eventBuilder.withData(dataBuffer.toString());

        // Set the data buffer and the event name buffer to the empty string.
        dataBuffer = new StringBuilder();
        eventName = "";

        return eventBuilder.build();
        // If the line starts with a U+003A COLON character (':')
      } else if (line.startsWith(":")) {
        // ignore the line
        // If the line contains a U+003A COLON character (':') character
      } else if (line.contains(":")) {
        // Collect the characters on the line before the first U+003A COLON character (':'),
        // and let field be that string.
        final int colonIdx = line.indexOf(":");
        final String field = line.substring(0, colonIdx);

        // Collect the characters on the line after the first U+003A COLON character (':'),
        // and let value be that string.
        // If value starts with a single U+0020 SPACE character, remove it from value.
        String value = line.substring(colonIdx + 1);
        value = value.startsWith(" ") ? value.substring(1) : value;

        processField(field, value);
      // Otherwise, the string is not empty but does not contain a U+003A COLON character (':')
      // character
      } else {
        processField(line, "");
      }
    }
  }
649922
function emitEvent(emitter, event, data) {    
  process.nextTick(function() {
    emitter.emit(event, data);
  });
}
634189
def _event_received(self, ref, data):
        
        match = self._resolve_match_data(ref, data)
        if match:
            if self.flag_to_set:
                self.flag_to_set.set()
            if self.callback:
                self.callback(EventMatch(ref, data, match))
            if self.__forget:
                self.forget()
1260070
private void processParentEvent(WatchedEvent event) throws Exception {
        // get current children snapshot and reset this watch.
        Set<String> children = new TreeSet<String>(m_zk.getChildren(m_rootNode, m_parentWatch));
        // intersect to get newChildren and update m_lastChildren to the current set.
        Set<String> newChildren = new HashSet<String>(children);
        newChildren.removeAll(m_lastChildren);
        m_lastChildren = children;

        List<ByteArrayCallback> callbacks = new ArrayList<ByteArrayCallback>();
        for (String child : children) {
            ByteArrayCallback cb = new ByteArrayCallback();
            // set watches on new children.
            if(newChildren.contains(child)) {
                m_zk.getData(ZKUtil.joinZKPath(m_rootNode, child), m_childWatch, cb, null);
            } else {
                m_zk.getData(ZKUtil.joinZKPath(m_rootNode, child), false, cb, null);
            }

            callbacks.add(cb);
        }

        HashMap<String, JSONObject> cache = new HashMap<String, JSONObject>();
        for (ByteArrayCallback callback : callbacks) {
            try {
                byte payload[] = callback.get();
                JSONObject jsObj = new JSONObject(new String(payload, "UTF-8"));
                cache.put(callback.getPath(), jsObj);
            } catch (KeeperException.NoNodeException e) {
                // child may have been deleted between the parent trigger and getData.
            }
        }

        m_publicCache.set(ImmutableMap.copyOf(cache));
        if (m_cb != null) {
            m_cb.run(m_publicCache.get());
        }
    }
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);
        }
    }
973774
public void processRequest(RequestEvent arg0) {
    LOG.trace("request received !");
    synchronized (listeners) {
      Iterator<SipListener> iter = listeners.iterator();
      while (iter.hasNext() == true) {
        SipListener listener = iter.next();
        LOG.trace("calling listener");
        listener.processRequest(arg0);
      }
    }
  }
1072015
void process(EventEnvelope envelope) {
        Object event = getEvent(envelope);
        String serviceName = envelope.getServiceName();
        EventPublishingService<Object, Object> service = eventService.nodeEngine.getService(serviceName);
        Registration registration = getRegistration(envelope, serviceName);
        if (registration == null) {
            return;
        }
        service.dispatchEvent(event, registration.getListener());
    }
677990
protected void processResult(RO result) {
        for (ResultHandler<RO> resultHandler : resultHandlers) {
            resultHandler.handleResult(result);
        }
    }
173714
public void processThisMessage()
    {
        Utility.getLogger().info("On message called in receiving process");
        try {
            BaseMessage messageIn = this.getMessage();
            if (messageIn != null)
            {
                BaseMessage messageReply = this.createReplyMessage(messageIn);
                this.moveScreenParamsToMessage(messageReply);
                // Step 2 - Get the body part of the message
                this.getTransport().setupReplyMessage(messageReply, messageIn, MessageInfoTypeModel.REPLY, MessageTypeModel.MESSAGE_IN);
            
                this.getTransport().processIncomingMessage(messageReply, null);
            }
        } catch(Exception ex) {
            ex.printStackTrace();
            Debug.print(ex, "Error in processing or replying to a message");
        }
    }
58397
@Override
  public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {
    addStartEventListener(processDefinition);
    addEndEventListener(processDefinition);
  }
1256314
@Override
    public void processEvent(ListenerEvent event, SequenceVectors<T> sequenceVectors, long argument) {
        try {
            locker.acquire();

            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

            StringBuilder builder = new StringBuilder(targetFolder.getAbsolutePath());
            builder.append("/").append(modelPrefix).append("_").append(sdf.format(new Date())).append(".seqvec");
            File targetFile = new File(builder.toString());

            if (useBinarySerialization) {
                SerializationUtils.saveObject(sequenceVectors, targetFile);
            } else {
                throw new UnsupportedOperationException("Not implemented yet");
            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            locker.release();
        }
    }
86319
public void handleEvent(Event event) {
        String topic = event.getTopic();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Received event topic: " + topic);
        }
        HttpInboundLink link = event.getProperty(CallbackIDs.CALLBACK_HTTPICL.getName(), HttpInboundLink.class);
        if (null != link) {
            if (tc.isEventEnabled()) {
                Tr.event(tc, "Processing request on new thread; " + link);
            }
            link.ready(link.getVirtualConnection());
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Unable to process pipelined request with null link");
            }
        }
    }