<commit_before>package org.ppl.core;

import java.util.HashMap;
import java.util.Map;

import org.ppl.BaseClass.BaseCronThread;
import org.ppl.BaseClass.LibThread;
import org.ppl.Module.ModuleBind;
import org.ppl.etc.Config;
import org.ppl.etc.UrlClassList;
import org.ppl.etc.globale_config;
import org.ppl.io.TimeClass;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.name.Names;

public class CronThread extends LibThread {
	private Map<String, Integer> cronMap;
	
	@Override
	public void run() {
		// TODO Auto-generated method stub
		super.run();
		ListQueue();
	}

	@Override
	public void ListQueue() {
		// TODO Auto-generated method stub
		UrlClassList ucl = UrlClassList.getInstance();
		TimeClass tc = TimeClass.getInstance();
		cronMap = new HashMap<String, Integer>();
		Config mConfig = new Config(globale_config.Config);
		int cronDelay = mConfig.GetInt("cronDelay");
		for (String ps : ucl.getPackList()) {
			try {
				Class<?> clazz = Class.forName(ps);

				if (clazz.getSuperclass().equals(BaseCronThread.class)) {
					String name = SliceName(ps);
					cronMap.put(name, 0);					
				}
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
				
		while (true) {
			try {
				Thread.sleep(60 * cronDelay * 1000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			int now = (int)tc.time();
			
			int nowHour = Integer.valueOf(tc.TimeStamptoDate(tc.time(), "hh"));
			int nowDay = Integer.valueOf(tc.TimeStamptoDate(tc.time(), "dd"));
						
			for (String key:cronMap.keySet()) {
				Injector injector = Guice
						.createInjector(new ModuleBind());
				BaseCronThread cron = (BaseCronThread) injector
						.getInstance(Key.get(BaseCronThread.class,
								Names.named(key)));
				boolean isStop = cron.isStop();
				if(isStop == false) continue;
				
				int minu = cron.minute();
				int hour = cron.hour();
				int day = cron.day();
				
				int sleepTime = cronMap.get(key);
				int newTime = 0;
				if(day == 0 && hour == 0 && sleepTime < now){					
					newTime = now+minu*60;
				}else if (day==0 && hour == nowHour && sleepTime < now) {					
					newTime = now+minu*60+hour*60*60;
				}else if (day == nowDay && sleepTime < now) {					
					newTime =  now+hour*60*60+minu*60+86400;
				}
				else {
					cron.free();
					System.out.println("key:"+key);<commit_msg>threah free db<commit_after>package org.ppl.core;

import java.util.HashMap;
import java.util.Map;

import org.ppl.BaseClass.BaseCronThread;
import org.ppl.BaseClass.LibThread;
import org.ppl.Module.ModuleBind;
import org.ppl.etc.Config;
import org.ppl.etc.UrlClassList;
import org.ppl.etc.globale_config;
import org.ppl.io.TimeClass;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.name.Names;

public class CronThread extends LibThread {
	private Map<String, Integer> cronMap;
	
	@Override
	public void run() {
		// TODO Auto-generated method stub
		super.run();
		ListQueue();
	}

	@Override
	public void ListQueue() {
		// TODO Auto-generated method stub
		UrlClassList ucl = UrlClassList.getInstance();
		TimeClass tc = TimeClass.getInstance();
		cronMap = new HashMap<String, Integer>();
		Config mConfig = new Config(globale_config.Config);
		int cronDelay = mConfig.GetInt("cronDelay");
		for (String ps : ucl.getPackList()) {
			try {
				Class<?> clazz = Class.forName(ps);

				if (clazz.getSuperclass().equals(BaseCronThread.class)) {
					String name = SliceName(ps);
					cronMap.put(name, 0);					
				}
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
				
		while (true) {
			try {
				Thread.sleep(60 * cronDelay * 1000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			int now = (int)tc.time();
			
			int nowHour = Integer.valueOf(tc.TimeStamptoDate(tc.time(), "hh"));
			int nowDay = Integer.valueOf(tc.TimeStamptoDate(tc.time(), "dd"));
						
			for (String key:cronMap.keySet()) {
				Injector injector = Guice
						.createInjector(new ModuleBind());
				BaseCronThread cron = (BaseCronThread) injector
						.getInstance(Key.get(BaseCronThread.class,
								Names.named(key)));
				boolean isStop = cron.isStop();
				if(isStop == false) {
					cron.free();
					continue;
				}
				
				int minu = cron.minute();
				int hour = cron.hour();
				int day = cron.day();
				
				int sleepTime = cronMap.get(key);
				int newTime = 0;
				if(day == 0 && hour == 0 && sleepTime < now){					
					newTime = now+minu*60;
				}else if (day==0 && hour == nowHour && sleepTime < now) {					
					newTime = now+minu*60+hour*60*60;
				}else if (day == nowDay && sleepTime < now) {					
					newTime =  now+hour*60*60+minu*60+86400;
				}
				else {
					cron.free();
					System.out.println("key:"+key);
{'fraction_non_alphanumeric': 0.14011976047904193, 'fraction_numerical': 0.011976047904191617, 'mean_word_length': 3.1723563696919235, 'pattern_counts': {'":': 0, '<': 15, '<?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': '3376328', 'n_tokens_mistral': 2125, 'n_tokens_neox': 1701, 'n_words': 368}