<commit_before><commit_msg>Simple mailet that counts in memory and logs the counter.  Useful for testing how many messages gets through.<commit_after>/*
 * Copyright (C) The Apache Software Foundation. All rights reserved.
 *
 * This software is published under the terms of the Apache Software License
 * version 1.1, a copy of which has been included with this distribution in
 * the LICENSE file.
 */
package org.apache.james.transport.mailets.debug;

import org.apache.mailet.*;

/**
 * A simple in memory counter.  Designed to count messages sent to this recipient
 * for debugging purposes.
 *
 * @author  <NAME> <<EMAIL>>
 */
public class Counter extends GenericMailet {
    int counter = 0;

    public void service(Mail mail) {
        //Do nothing
        counter++;
        log(counter + "");
        mail.setState(Mail.GHOST);
    }

    public String getMailetInfo() {
        return "Counter Mailet";
    }
}

{'fraction_non_alphanumeric': 0.09100758396533044, 'fraction_numerical': 0.0032502708559046588, 'mean_word_length': 3.1066666666666665, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '3314495', 'n_tokens_mistral': 256, 'n_tokens_neox': 251, 'n_words': 101}