Package com.google.code.ftspc.lector

Source Code of com.google.code.ftspc.lector.Main

package com.google.code.ftspc.lector;

import com.google.code.ftspc.lector.Server.FTP.FTPThread;
import org.quartz.Trigger;
import com.google.code.ftspc.lector.ini_and_vars.Lector_Ini;
import com.google.code.ftspc.lector.indexers.Indexer;
import com.google.code.ftspc.lector.ini_and_vars.Vars;
import java.util.Timer;
import org.quartz.JobDetail;

import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
import static org.quartz.JobBuilder.newJob;
import static org.quartz.TriggerBuilder.newTrigger;

/**
* Main Class
* @author Arthur Khusnutdinov
*/
public class Main {
//-Xmx1700m -Xms1500m

    /**
     * Main function
     * @param args Not used.
     */
    public static void main(String[] args) {
        Vars.fileSeparator = System.getProperty("file.separator");
        Indexer indexer;
        Vars.server_thread_status = true;
        try {
            Lector_Ini.class.newInstance().configure();

            FTPThread FTPThreadLocal = new FTPThread();
            FTPThreadLocal.start();

            indexer = (Indexer) (Class.forName(Vars.IndexerToUse)).newInstance();
            indexer.startIndex();

//            Timer dubl_remover_Timer = new Timer();
//            dubl_remover_Timer.schedule(new Dubl_Remover(), 0, 3600000);
            Timer InfoThreadTimer = new Timer();
            InfoThreadTimer.schedule(new InfoThread(), 0, 1000);


            JobDetail job = newJob(com.google.code.ftspc.lector.CheckDateForPath.class).
                    withIdentity("jobForCheckDateForPath", "Lector").build();

            Trigger trigger = newTrigger().withIdentity("triggerForCheckDateForPath", "Lector").
                    withSchedule(simpleSchedule().withIntervalInHours(1).
                    repeatForever()).startNow().build();

            Vars.sched.scheduleJob(job, trigger);
        } catch (Exception ex) {
            ex.printStackTrace();
            Vars.logger.fatal("Error: ", ex);
            ex.printStackTrace();
        }
    }
}
TOP

Related Classes of com.google.code.ftspc.lector.Main

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.