All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.gdface.service.sdk.FaceApiServiceMain Maven / Gradle / Ivy

package net.gdface.service.sdk;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import org.jboss.netty.logging.InternalLoggerFactory;
import org.jboss.netty.logging.Slf4JLoggerFactory;

/**
 * 启动 FaceApi thrift 服务
 * @author guyadong
 *
 */
public class FaceApiServiceMain implements FaceApiServiceConstants{
	private static final FaceApiServiceConfig serviceConfig = FaceApiServiceConfig.getInstance();

	public FaceApiServiceMain() {
	}
	private static void waitquit(){
		System.out.println("PRESS 'quit' OR 'CTRL-C' to exit");
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); 
		try{
			while(!"quit".equalsIgnoreCase(reader.readLine())){				
			}
			System.exit(0);
		} catch (IOException e) {

		}finally {

		}
	}
	public static void main(String ...args){
		Logo.textLogo();
		serviceConfig.parseCommandLine(args);
		// 设置slf4j记录日志,否则会有警告
		InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory());
		FaceApiService.buildService().startAsync();
		if(serviceConfig.isXhrStart()){
			FaceApiService.buildHttpService().startAsync();
		}
		if(serviceConfig.isRestfulStart()){
			FaceApiService.startRestfulService();
		}
		waitquit();
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy