<commit_before>package com.dianping.cat.consumer.dump;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.codehaus.plexus.logging.LogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;

import com.dianping.cat.configuration.ServerConfigManager;
import com.dianping.cat.message.spi.MessageCodec;
import com.site.lookup.ContainerHolder;
import com.site.lookup.annotation.Inject;

public class DumpChannelManager extends ContainerHolder implements Initializable, LogEnabled {
	@Inject
	private MessageCodec m_codec;

	private Map<String, DumpChannel> m_channels = new HashMap<String, DumpChannel>();

	private Map<String, Integer> m_indexes = new HashMap<String, Integer>();

	private long m_maxSize;

	private long m_lastChunkAdjust = 100 * 1024L; // 100K

	private String m_baseDir;

	private Logger m_logger;

	public void closeAllChannels() {
		for (DumpChannel channel : m_channels.values()) {
			closeChannel(channel);
		}

		m_channels.clear();
	}

	public void closeAllChannels(long startTime) {
		for (DumpChannel channel : m_channels.values()) {
			if (channel.getStartTime() == startTime) {
				closeChannel(channel);
			}
		}

		m_channels.clear();
	}

	public void closeChannel(DumpChannel channel) {
		release(channel);
		channel.close();

		File outbox = new File(m_baseDir, "outbox");

		outbox.mkdirs();

		try {
			channel.moveTo(outbox);
		} catch (IOException e) {
			m_logger.error(String.format("Error when moving file(%s) to directory(%s)!", channel.getFile(), outbox), e);
		}
	}

	@Override
	public void enableLogging(Logger logger) {
		m_logger = logger;
	}
<commit_msg>close dump channel fix<commit_after>package com.dianping.cat.consumer.dump;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.codehaus.plexus.logging.LogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;

import com.dianping.cat.configuration.ServerConfigManager;
import com.dianping.cat.message.spi.MessageCodec;
import com.site.lookup.ContainerHolder;
import com.site.lookup.annotation.Inject;

public class DumpChannelManager extends ContainerHolder implements Initializable, LogEnabled {
	@Inject
	private MessageCodec m_codec;

	private Map<String, DumpChannel> m_channels = new HashMap<String, DumpChannel>();

	private Map<String, Integer> m_indexes = new HashMap<String, Integer>();

	private long m_maxSize;

	private long m_lastChunkAdjust = 100 * 1024L; // 100K

	private String m_baseDir;

	private Logger m_logger;

	public void closeAllChannels() {
		for (DumpChannel channel : m_channels.values()) {
			closeChannel(channel);
		}

		m_channels.clear();
	}

	public void closeAllChannels(long startTime) {
		for (DumpChannel channel : m_channels.values()) {
			if (channel.getStartTime() <= startTime) {
				closeChannel(channel);
			}
		}

		m_channels.clear();
	}

	public void closeChannel(DumpChannel channel) {
		release(channel);
		channel.close();

		File outbox = new File(m_baseDir, "outbox");

		outbox.mkdirs();

		try {
			channel.moveTo(outbox);
		} catch (IOException e) {
			m_logger.error(String.format("Error when moving file(%s) to directory(%s)!", channel.getFile(), outbox), e);
		}
	}

	@Override
	public void enableLogging(Logger logger) {
		m_logger = logger;
	}

{'fraction_non_alphanumeric': 0.1131557264487778, 'fraction_numerical': 0.005492996429552321, 'mean_word_length': 5.090301003344481, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, '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': '3960045', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1151, 'n_words': 247}