package com.yangmuyao;

import com.yangmuyao.pipeline.HttpServerPipelineFactory;
import com.yangmuyao.utils.FileProcessTask;
import org.apache.log4j.Logger;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;

import java.net.InetSocketAddress;
import java.util.Timer;
import java.util.concurrent.Executors;
import sun.misc.BASE64Encoder;
import java.io.File;

/**
 * Created by fengyuyangchen on 16/6/12.
 */


public class Main {


    public static void main(String [] args) throws  Exception{

        ServerBootstrap  bootstrap =  new ServerBootstrap( new NioServerSocketChannelFactory(
                Executors.newCachedThreadPool(),
                Executors.newCachedThreadPool()
        ));

        bootstrap.setPipelineFactory( new HttpServerPipelineFactory());
        bootstrap.bind( new InetSocketAddress(7001));
        Logger log = Logger.getLogger("Main");
        log.info("Server Has Been Started, Please visit http://127.0.0.1:7001/index.html To See It");

//        java.util.Timer timer = new Timer();
//        timer.schedule( new FileProcessTask(),1000,1000);
    }

}

@@ -17,16 +17,52 @@
 muyao;%0A%0A
+import com.yangmuyao.ks3.KS3Client;%0A
 import c
@@ -326,218 +326,1588 @@
 ava.
-net.InetSocketAddress;%0Aimport java.util.Timer;%0Aimport java.util.concurrent.Executors;%0Aimport sun.misc.BASE64Encoder;%0Aimport java.io.File;%0A%0A/**%0A * Created by fengyuyangchen on 16/6/12.%0A */%0A%0A%0Apublic class Main %7B%0A
+io.FileInputStream;%0Aimport java.io.ObjectInputStream;%0Aimport java.net.InetSocketAddress;%0Aimport java.util.Iterator;%0Aimport java.util.Timer;%0Aimport java.util.concurrent.ConcurrentLinkedQueue;%0Aimport java.util.concurrent.Executors;%0Aimport sun.misc.BASE64Encoder;%0Aimport java.io.File;%0A%0A/**%0A * Created by fengyuyangchen on 16/6/12.%0A */%0A%0A%0Apublic class Main %7B%0A    public static Logger    log = Logger.getLogger(Main.class);%0A    /**%0A     * %E6%A3%80%E6%9F%A5%E6%98%AF%E5%90%A6%E6%9C%89%E7%BC%93%E5%AD%98%E7%9A%84,%E6%9C%AA%E5%8F%91%E9%80%81%E7%9A%84%E6%95%B0%E6%8D%AE%E6%96%87%E4%BB%B6,%E8%8B%A5%E6%9C%89,%E5%8F%91%E9%80%81%E4%B9%8B%0A     * @throws Exception%0A     */%0A    public void flushCache() throws Exception%7B%0A%0A        ObjectInputStream ins = null;%0A        try%7B%0A            ins  = new ObjectInputStream(new FileInputStream(%22FileListCache%22));%0A        %7Dcatch (Exception e)%7B%0A            log.warn(%22No Cache File to Deal with%22);%0A            return;%0A        %7D%0A%0A        ConcurrentLinkedQueue%3CString%3E filelist = (ConcurrentLinkedQueue%3CString%3E)ins.readObject();%0A        KS3Client       ks3 = null;%0A%0A        if ( filelist == null %7C%7C filelist.size() == 0)%7B%0A            log.info(%22No cache File to send%22);%0A        %7Delse%7B%0A            ks3 = new KS3Client(KS3Client.BEIJING);%0A            ks3.setBucket(%22citrusjoy.matrix.storage%22);%0A        %7D%0A        Iterator it  = filelist.iterator();%0A        while ( it.hasNext() )%7B%0A%0A            String value = it.next().toString();%0A            log.debug(%22Cache File:%22 + value);%0A%0A            File f = new File(value);%0A            if ( !f.exists() %7C%7C f.length() == 0 )%7B%0A                log.info(value + %22:  Skipped%22);%0A            %7Delse%7B%0A                ks3.putFile(f.getName(),value);%0A            %7D%0A        %7D%0A        ins.close();%0A    %7D
 %0A%0A  
@@ -1960,32 +1960,66 @@
 ws  Exception%7B%0A%0A
+        new Main().flushCache();%0A%0A
         ServerBo
@@ -2482,18 +2482,16 @@
  It%22);%0A%0A
-//
         
@@ -2527,18 +2527,16 @@
 imer();%0A
-//
         

add cache file proccess when startup