<commit_before>/*
 * Created on 21/08/2006 21:07:36
 */
package net.jforum.api.integration.mail.pop;

import java.util.Iterator;
import java.util.List;

import net.jforum.dao.DataAccessDriver;
import net.jforum.entities.MailIntegration;

import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
 * @author <NAME>
 * @version $Id: POPListener.java,v 1.9 2006/10/10 01:59:55 rafaelsteil Exp $
 */
public class POPListener implements Job
{
	private static final Logger LOGGER = Logger.getLogger(POPListener.class);
	private static boolean working = false;
	protected transient POPConnector connector = new POPConnector();
	
	/**
	 * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
	 */
	public void execute(final JobExecutionContext jobContext) throws JobExecutionException
	{
		if (working) {
			LOGGER.debug("Already working. Leaving for now.");
		} else {	
			try {
				working = true;

				final List<MailIntegration> integrationList = DataAccessDriver.getInstance().newMailIntegrationDAO().findAll();
				final POPParser parser = new POPParser();
				
				for (final Iterator<MailIntegration> iter = integrationList.iterator(); iter.hasNext(); ) {
					final MailIntegration integration = iter.next();
					
					connector.setMailIntegration(integration);
					
					try {
						LOGGER.debug("Going to check " + integration);
						
						connector.openConnection();
						parser.parseMessages(connector);
						<commit_msg>Fix connection close exception<commit_after>/*
 * Created on 21/08/2006 21:07:36
 */
package net.jforum.api.integration.mail.pop;

import java.util.Iterator;
import java.util.List;

import net.jforum.dao.DataAccessDriver;
import net.jforum.entities.MailIntegration;

import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
 * @author <NAME>
 * @version $Id: POPListener.java,v 1.9 2006/10/10 01:59:55 rafaelsteil Exp $
 */
public class POPListener implements Job
{
	private static final Logger LOGGER = Logger.getLogger(POPListener.class);
	private static boolean working = false;
	protected POPConnector connector = new POPConnector();
	
	/**
	 * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
	 */
	public void execute(final JobExecutionContext jobContext) throws JobExecutionException
	{
		if (working) {
			LOGGER.debug("Already working. Leaving for now.");
		} else {	
			try {
				working = true;

				final List<MailIntegration> integrationList = DataAccessDriver.getInstance().newMailIntegrationDAO().findAll();
				final POPParser parser = new POPParser();
				
				for (final Iterator<MailIntegration> iter = integrationList.iterator(); iter.hasNext(); ) {
					final MailIntegration integration = iter.next();
					
					connector.setMailIntegration(integration);
					
					try {
						LOGGER.debug("Going to check " + integration);
						
						connector.openConnection();
						parser.parseMessages(connector);
						
{'fraction_non_alphanumeric': 0.11020006559527715, 'fraction_numerical': 0.020334535913414234, 'mean_word_length': 4.091819699499165, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6984184', 'n_tokens_mistral': 1100, 'n_tokens_neox': 887, 'n_words': 206}