org.bitbucket.ab.jfqm.Main.java Source code

Java tutorial

Introduction

Here is the source code for org.bitbucket.ab.jfqm.Main.java

Source

/**
*   This file is part of JFileQueueManager.
*   JFileQueueManager is free software: you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation, either version 3 of the License, or
*   (at your option) any later version.
*
*   JFileQueueManager is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   along with JFileQueueManager.  If not, see <http://www.gnu.org/licenses/>.
*
*   (   ? JFileQueueManager.
*
*   JFileQueueManager - ?? :   ???  /
*   ?   ??  ?  GNU   ,
*         ?  ??;
*    ? 3 ,  (  )   
*   ?.
*
*   JFileQueueManager ?????  ,    ,
*      ???;   ?  ?? ?
*    ?  ?? .  ?.  
*   ?  GNU.
*
*         ?  GNU
*   ? ? ? . ? ?  , ?.
*   <http://www.gnu.org/licenses/>.)
*/
package org.bitbucket.ab.jfqm;

import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentSkipListSet;

import org.apache.log4j.Logger;
import org.bitbucket.ab.jfqm.scheduler.ITimeoutJob;
import org.bitbucket.ab.jfqm.scheduler.MoveJobConsumer;
import org.bitbucket.ab.jfqm.scheduler.MoveJobProducer;
import org.bitbucket.ab.jfqm.scheduler.impl.MoveJob;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author Dmitry Myasnikov <saver_is_not@bk.ru>
 * @author Victor Letovaltsev <Z_U_B_R_U_S@mail.ru>
 */
public class Main {

    static final Logger logger = Logger.getLogger(Main.class);

    private static ClassPathXmlApplicationContext beanFactory;

    /**
     * @param args
     */
    public static void main(String[] args) {
        beanFactory = new ClassPathXmlApplicationContext("config.xml");
        List<ITimeoutJob> bean = (List<ITimeoutJob>) beanFactory.getBean("jobList");
        ConcurrentSkipListSet<ITimeoutJob> jobsSet = new ConcurrentSkipListSet<ITimeoutJob>(bean);
        //BlockingQueue<MoveJob> b = new LinkedBlockingQueue<MoveJob>();
        MoveJobProducer m2 = new MoveJobProducer(jobsSet);
        BlockingQueue<MoveJob> b = (BlockingQueue<MoveJob>) beanFactory.getBean("jobQueue");
        MoveJobConsumer c2 = new MoveJobConsumer(b);
        new Thread(m2).start();
        new Thread(c2).start();

    }

}