⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 servermainclass.java

📁 一个用java实现 的飞机订票系统,超级好用....
💻 JAVA
字号:
package com.zhu.server;

import java.net.*;
import java.io.*;
import java.util.*;

import com.zhu.dao.*;
import com.zhu.dao.impl.*;





/*
 *  @author zhutingfa
 */
public class ServerMainClass {
	
	public static Set allOnlineAgents;//所有在线代理商
	public static AgentDAO agentDao;
	public static FlightDAO flightDao;
	public static FlightDAO flightDaoSch;
	public static PlaneModelDAO planeModelDao;
	public static OrderDAO	orderDao;
   public static Set currentAgents;
	public static Properties pro;//初始化配置参数

	/**
	 * 静态初始化方法。
	 *
	 */
	public static void init(){
		currentAgents=new HashSet();
		pro=new Properties();
		try {
			pro.load(new FileInputStream("server_config.txt"));
		}catch (IOException e) {
			System.out.println("找不到配置文件或配置文件格式不正确!");
			e.printStackTrace();
		}
			agentDao=new AgentDAOImpl();
			flightDao=new FlightDAOImpl();
			flightDaoSch=new FlightDAOImpl();
			planeModelDao=new PlaneModelDAOImpl();
			orderDao=new OrderDAOImpl();
		   allOnlineAgents=new HashSet();
	}
	public static void main(String[] args) {
		init();
		ServerMainFrame sFrame=new ServerMainFrame();
		sFrame.showMe();
		
		ServerSocket ss=null;
		Socket s=null;
		try {
			ss=new ServerSocket(Integer.parseInt(pro.getProperty("ServerPort")));
			while(true){
				s=ss.accept();
				new ServerThread(s).start();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -