private void addToBatch(LogMessage msg) {
        List<LogMessage> toSend = null;
        synchronized (this) {
            if (currentBatchList == null) {
                currentBatchList = new ArrayList<LogMessage>(batchSize);
                currentBatchList.add(msg);
                return;
            }

            currentBatchList.add(msg);

            if (currentBatchList.size() == batchSize) {
                toSend = stealBatch();
            }
        }
        flushBatch(toSend);
    }
Dispatches a message to all the LogHandler instances we've
got registered.  The main entry point for LogMessage instances
into the log server.

@param msg The LogMessage instance we wish to dispatch to the
           plugins
logserver/src/main/java/com/yahoo/logserver/LogDispatcher.java