Processes the message sent to the batcher. This method tries to write to
the queue. If the queue is full, the send blocks and waits for the
available space.

@param message
- The message to be processed
482235
public void processSync(T message) {
        // If this batcher has been shutdown, do not accept any more messages
        if (isShutDown) {
            return;
        }

        try {
            queueSizeTracer.record(queue.size());
        } catch (Throwable ignored) {
        }

        try {
            Stopwatch s = batchSyncPutTracer.start();
            queue.put(message);
            s.stop();
        } catch (InterruptedException e) {
            return;
        }
        numberAdded.incrementAndGet();
    }
377342
protected function processMessage($message) {
    // Check if the message was forward
    isset($message['forward_from']) ? $index = 'forward_from' : $index = 'from';

    $response = $this->prepareResponse($message[$index]);
    $this->sendMessage($response);
  }
1135105
public void send(Message message)
  {
    Transport smtp = null;

    try {
      smtp = _session.getTransport("smtp");

      smtp.connect();

      smtp.send(message, _to);

      log.fine(this + " sent mail to " + _to[0]);
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      throw new RuntimeException(e);
    } finally {
      try {
        if (smtp != null)
          smtp.close();
      } catch (Exception e) {
        log.log(Level.FINER, e.toString(), e);
      }
    }
  }
668758
private void sendToIndex(String message) {
		try {
			getMessaging().queueMessage(SolrWrapperQueueConsumer.QUEUE_ID, message);
		} catch (MessagingException ex) {
			log.error("Unable to send message: ", ex);
		}
	}
1037711
private void send(String message) {
    String scopeMessage = message.length() + " " + message;
    logger.finest("WRITE : " + scopeMessage);
    byte[] bytes = null;
    try {
      bytes = scopeMessage.getBytes("UTF-16BE");
    } catch (UnsupportedEncodingException e) {
      close();
      connectionHandler.onException(e);
      return;
    }
    ByteBuffer buffer = ByteBuffer.allocate(bytes.length);
    buffer.put(bytes);
    requests.add(buffer);
    monitor.modify(socketChannel, this, SelectionKey.OP_READ | SelectionKey.OP_WRITE);
  }
470276
void processTedQueue() {
		int totalProcessing = context.taskManager.calcWaitingTaskCountInAllChannels();
		if (totalProcessing >= TaskManager.LIMIT_TOTAL_WAIT_TASKS) {
			logger.warn("Total size of waiting tasks ({}) already exceeded limit ({}), skip this iteration (2)", totalProcessing, TaskManager.LIMIT_TOTAL_WAIT_TASKS);
			return;
		}
		Channel channel = context.registry.getChannelOrMain(Model.CHANNEL_QUEUE);
		int maxTask = context.taskManager.calcChannelBufferFree(channel);
		maxTask = Math.min(maxTask, 50);
		Map<String, Integer> channelSizes = new HashMap<String, Integer>();
		channelSizes.put(Model.CHANNEL_QUEUE, maxTask);
		List<TaskRec> heads = tedDao.reserveTaskPortion(channelSizes);
		if (heads.isEmpty())
			return;

		for (final TaskRec head : heads) {
			logger.debug("exec eventQueue for '{}', headTaskId={}", head.key1, head.taskId);
			channel.workers.execute(new TedRunnable(head) {
				@Override
				public void run() {
					processEventQueue(head);
				}
			});
		}
	}
733460
def start_message_processing(self):
        
        t = InfiniteLoopThread(self.process_messages, thread_name="MESSAGEPROCESSOR", wait_between_runs=0.5)
        t.start()
        return t
266026
public void send(Message msg) throws Exception {
        num_senders.incrementAndGet();
        long size=msg.size();

        lock.lock();
        try {
            if(count + size >= transport.getMaxBundleSize())
                sendBundledMessages();

            addMessage(msg, size);

            // at this point, we haven't sent our message yet !
            if(num_senders.decrementAndGet() == 0) // no other sender threads present at this time
                sendBundledMessages();
            // else there are other sender threads waiting, so our message will be sent by a different thread
        }
        finally {
            lock.unlock();
        }
    }
1222649
public void sendMessage(Message message) throws RemoteException
    {
        Utility.getLogger().info("EJB sendMessage: " + message);
        if (((BaseMessage)message).isProcessedByClient())
            ((BaseMessage)message).setProcessedByClientSession(this.getParentSession());
        m_messageSender.sendMessage(message);
    }
580070
private void doBatchMessage(final JsonObject message) {
    String batchID = message.getString("batch");
    if (currentBatch != null && currentBatch.id().equals(batchID)) {
      Object value = deserializer.deserialize(message);
      if (value != null) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("%s - Batch received: Batch[batch=%s, id=%d, message=%s]", this, batchID, message.getLong("id"), value));
        }
        currentBatch.handleMessage(value);
      }
    }
  }
594201
public void sendMessage(String message) {
        EventBuilder eventBuilder = new EventBuilder().withMessage(message)
            .withLevel(Event.Level.INFO);
        sendEvent(eventBuilder);
    }
1121313
public void send(byte[] message) {
		try {
			ps.write(message);
		} catch (IOException ioe) {
			System.out.println(new LogEntry(Level.CRITICAL, "IO exception occurred while writing to client", ioe));
			connection.close("IO exception occurred while writing to client");
		}
	}
725870
private void processNow() {
        List<T> toProcess;
        boolean scheduleNextBatchImmediately = false;
        synchronized (mutex) {
            int count = inbox.size();
            Log.v(Log.TAG_BATCHER, "%s: processNow() called, inbox size: %d", this, count);
            if (count == 0)
                return;
            else if (count <= capacity) {
                toProcess = new ArrayList<T>(inbox);
                inbox.clear();
            } else {
                toProcess = new ArrayList<T>(inbox.subList(0, capacity));
                for (int i = 0; i < capacity; i++)
                    inbox.remove(0);
                scheduleNextBatchImmediately = true;
            }
            mutex.notifyAll();
        }

        synchronized (processMutex) {
            if (toProcess != null && toProcess.size() > 0) {
                Log.v(Log.TAG_BATCHER, "%s: invoking processor %s with %d items",
                        this, processor, toProcess.size());
                processor.process(toProcess);
            } else
                Log.v(Log.TAG_BATCHER, "%s: nothing to process", this);

            synchronized (mutex) {
                lastProcessedTime = System.currentTimeMillis();
                scheduled = false;
                scheduleBatchProcess(scheduleNextBatchImmediately);
                Log.v(Log.TAG_BATCHER, "%s: invoking processor done",
                        this, processor, toProcess.size());
            }
            processMutex.notifyAll();
        }
    }
34964
public final synchronized void onHttpCallback(final byte[] message) {
    final long endTime = System.currentTimeMillis() + WAIT_TIMEOUT;
    while (cmdOutput != null) {
      final long waitTime = endTime - System.currentTimeMillis();
      if (waitTime <= 0) {
        break;
      }

      try {
        wait(WAIT_TIME);
      } catch (final InterruptedException e) {
        LOG.log(Level.WARNING, "HttpServeShellCmdHandler onHttpCallback InterruptedException: {0}", e);
      }
    }
    LOG.log(Level.INFO, "HttpServeShellCmdHandler OnCallback: {0}", HttpShellJobDriver.CODEC.decode(message));
    cmdOutput = HttpShellJobDriver.CODEC.decode(message);

    notify();
  }
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");
        }
    }
1282909
final void dispatchToAppender(final String message) {
    // dispatch a copy, since events should be treated as being immutable
    final FoundationFileRollingAppender appender = this.getSource();
    if (appender != null) {
      appender.append(new FileRollEvent(this, message));
    }
  }
852192
public void process() {
    // are we ready to process yet, or have we had an error, and are
    // waiting a bit longer in the hope that it will resolve itself?
    if (error_skips > 0) {
      error_skips--;
      return;
    }
    
    try {
      if (logger != null)
        logger.debug("Starting processing");
      status = "Processing";
      lastCheck = System.currentTimeMillis();

      // FIXME: how to break off processing if we don't want to keep going?
      processor.deduplicate(batch_size);

      status = "Sleeping";
      if (logger != null)
        logger.debug("Finished processing");
    } catch (Throwable e) {
      status = "Thread blocked on error: " + e;
      if (logger != null)
        logger.error("Error in processing; waiting", e);
      error_skips = error_factor;
    }
  }