<commit_before>package org.bitrepository.audittrails.collector;

import java.util.Date;
import java.util.TimerTask;

import org.bitrepository.common.utils.SettingsUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AuditTrailCollectionTimerTask extends TimerTask {
    private Logger log = LoggerFactory.getLogger(getClass());

    private final IncrementalCollector collector;
    /** The collection schedule */
    private final CollectionSchedule schedule;
    
    /**
     * @param collector The collector doing the actual work.
     * @param interval The interval between running this timer task.
     * @param gracePeriod The period that should pass before the first scheduled collection
     */
    public AuditTrailCollectionTimerTask(IncrementalCollector collector, long interval, int gracePeriod) {
        this.schedule = new CollectionSchedule(interval, gracePeriod);
        this.collector = collector;
        log.info("Scheduled next collection of audit trails for " + schedule.getNextRun());
    }
    
    /**
     * Get the next scheduled collection 
     */
    public Date getNextScheduledRun() {
        return schedule.getNextRun();
    }
    
    /**
     * Get the date of the last started collection 
     */
    public Date getLastCollectionStart() {
        return schedule.getLastStart();
    }
    
    /**
     * Get the date of the last finished collection 
     */
    public Date getLastCollectionFinish() {
        return schedule.getLastFinish();
    }
    
    /**
     * Run the operation and when finished set the date for the next collection.
     */
    public synchronized void runCollection() {
        schedule.start();
        collector.performCollection(SettingsUtils.getAuditContributorsForCollection(collector.getCollectionID()));
        schedule.finish();
        log.info("Scheduled next collection of audit trails for " + schedule.getNextRun());<commit_msg>add logging statement for being able to follow audit trail collection<commit_after>package org.bitrepository.audittrails.collector;

import java.util.Date;
import java.util.TimerTask;

import org.bitrepository.common.utils.SettingsUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AuditTrailCollectionTimerTask extends TimerTask {
    private Logger log = LoggerFactory.getLogger(getClass());

    private final IncrementalCollector collector;
    /** The collection schedule */
    private final CollectionSchedule schedule;
    
    /**
     * @param collector The collector doing the actual work.
     * @param interval The interval between running this timer task.
     * @param gracePeriod The period that should pass before the first scheduled collection
     */
    public AuditTrailCollectionTimerTask(IncrementalCollector collector, long interval, int gracePeriod) {
        this.schedule = new CollectionSchedule(interval, gracePeriod);
        this.collector = collector;
        log.info("Scheduled next collection of audit trails for " + schedule.getNextRun());
    }
    
    /**
     * Get the next scheduled collection 
     */
    public Date getNextScheduledRun() {
        return schedule.getNextRun();
    }
    
    /**
     * Get the date of the last started collection 
     */
    public Date getLastCollectionStart() {
        return schedule.getLastStart();
    }
    
    /**
     * Get the date of the last finished collection 
     */
    public Date getLastCollectionFinish() {
        return schedule.getLastFinish();
    }
    
    /**
     * Run the operation and when finished set the date for the next collection.
     */
    public synchronized void runCollection() {
        log.info("Starting collection of audit trails for collection: '" + collector.getCollectionID() + "'");
        schedule.start();
        collector.performCollection(SettingsUtils.getAuditContributorsForCollection(collector.getCollectionID()));
        schedule.finish();
        log.info("Scheduled next collection of audit trails for " + schedule.getNextRun());
{'fraction_non_alphanumeric': 0.08174386920980926, 'fraction_numerical': 0.0009908347783007183, 'mean_word_length': 3.1500513874614593, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4270168', 'n_tokens_mistral': 1014, 'n_tokens_neox': 981, 'n_words': 309}