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

📄 redirectip.java

📁 tomcat 分发tomcat 分发tomcat 分发tomcat 分发tomcat 分发tomcat 分发tomcat 分发tomcat 分发
💻 JAVA
字号:
package com.eassol;

import org.jdom.JDOMException;

public class RedirectIP {
	static int x = 0;
	private static RedirectIP redirectIP;

	// Constructor
	protected RedirectIP() {
	}

	// Methods
	public static RedirectIP getInstance() {
		// Uses "Lazy initialization"
		if (redirectIP == null)
			redirectIP = new RedirectIP();
		return redirectIP;
	}

	
	/**
	 * 根椐数字1,2,3返回不同的域名地址,中间检查域名是否可用。
	 * @return host 域名地址
	 * @throws Exception
	 * @throws JDOMException
	 */
	public String getWebIP() throws Exception, JDOMException {
		String host = DataSource.getParaValue("Domain_Name_DEFAULT");  //缺省住域名
		String temphost = "";
		x++;
		if (x > 4) { // 循环 1,2,3 这三个数字
			x = 0;
		}
		switch (x) {
		case 1:
			temphost = DataSource.getParaValue("Domain_Name_ONE");  //域名one
			if (null != URLAvailability.isConnect(temphost)) {
				host = temphost;
			}
			System.out.println(host);
			break;
		case 2:
			temphost = DataSource.getParaValue("Domain_Name_TWO");  //域名two
			if (null != URLAvailability.isConnect(temphost)) {
				host = temphost;
			}
			System.out.println(host);
			break;
		case 3:
			temphost = DataSource.getParaValue("Domain_Name_THREE");  //域名three
			if (null != URLAvailability.isConnect(temphost)) {
				host = temphost;
			}
			System.out.println(host);
			break;
		}
		return host;
	}

}//end class

⌨️ 快捷键说明

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