<commit_before>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 *
 */

package com.xpn.xwiki.stats.impl.xwiki;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.xpn.xwiki.XWikiContext;
import com.xpn.xwiki.doc.XWikiDocument;
import com.xpn.xwiki.stats.impl.StatsUtil;
import com.xpn.xwiki.stats.impl.VisitStats;
import com.xpn.xwiki.web.DownloadAction;
import com.xpn.xwiki.web.SaveAction;
import com.xpn.xwiki.web.ViewAction;

/**
 * Back-end statistics storing service.
 * 
 * @version $Id: $
 * @since 1.4M2
 */
public class XWikiStatsStoreService implements Runnable
{
    /**
     * Logging tools.
     */
    private static final Log LOG = LogFactory.getLog(XWikiStatsStoreService.class);

    /**
     * The queue containing the statistics to store.
     */
    private ArrayBlockingQueue<XWikiStatsStoreItem> queue;

    /**
     * The thread on which the storing service is running.
     */
    private Thread thread;

    /**
     * Create new instance of XWikiStatsRegister and init statistics queue.
     * 
     * @param context the XWiki context.
     */
    public XWikiStatsStoreService(XWikiContext context)
    {
        long queueSize = context.getWiki().ParamAsLong("stats.queue.size", 200);
        queue = new ArrayBlockingQueue<XWikiStatsStoreItem>((int) queueSize);
    }

    /**
     * Start storing thread.
     */
    public void start()
    {
        if (thread == null) {
            thread = new Thread(this);
            thread.start();
        }
    }
<commit_msg>Add name to statistics storage thread for debug<commit_after>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 *
 */

package com.xpn.xwiki.stats.impl.xwiki;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.xpn.xwiki.XWikiContext;
import com.xpn.xwiki.doc.XWikiDocument;
import com.xpn.xwiki.stats.impl.StatsUtil;
import com.xpn.xwiki.stats.impl.VisitStats;
import com.xpn.xwiki.web.DownloadAction;
import com.xpn.xwiki.web.SaveAction;
import com.xpn.xwiki.web.ViewAction;

/**
 * Back-end statistics storing service.
 * 
 * @version $Id: $
 * @since 1.4M2
 */
public class XWikiStatsStoreService implements Runnable
{
    /**
     * Logging tools.
     */
    private static final Log LOG = LogFactory.getLog(XWikiStatsStoreService.class);

    /**
     * The queue containing the statistics to store.
     */
    private ArrayBlockingQueue<XWikiStatsStoreItem> queue;

    /**
     * The thread on which the storing service is running.
     */
    private Thread thread;

    /**
     * Create new instance of XWikiStatsRegister and init statistics queue.
     * 
     * @param context the XWiki context.
     */
    public XWikiStatsStoreService(XWikiContext context)
    {
        long queueSize = context.getWiki().ParamAsLong("stats.queue.size", 200);
        queue = new ArrayBlockingQueue<XWikiStatsStoreItem>((int) queueSize);
    }

    /**
     * Start storing thread.
     */
    public void start()
    {
        if (thread == null) {
            thread = new Thread(this, "Statistics storing daemon");
            thread.start();
        }
    }

{'fraction_non_alphanumeric': 0.09171654759606102, 'fraction_numerical': 0.007337323807684881, 'mean_word_length': 3.2148087876322213, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2019579', 'n_tokens_mistral': 1525, 'n_tokens_neox': 1475, 'n_words': 508}