亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hashdistributionalgorithm.java

?? 簡單的分布式算法
?? JAVA
字號:
/***************************************************************************** * $Id: HashDistributionAlgorithm.java,v 1.2 2003/05/06 15:26:14 jheiss Exp $ ***************************************************************************** * Distribution algorithm based on the client's IP address.  If * possible, repeat connections coming from a given IP address are sent * back to the same server. ***************************************************************************** * Copyright 2003 Jason Heiss *  * This file is part of Distributor. *  * Distributor 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 2 of the License, or * (at your option) any later version. *  * Distributor 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 Distributor; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA ***************************************************************************** */package oss.distributor;import java.util.List;import java.util.Map;import java.util.Map.Entry;import java.util.HashMap;import java.util.Iterator;import java.util.logging.Logger;import java.net.InetAddress;import java.nio.channels.Selector;import java.nio.channels.SocketChannel;import org.w3c.dom.Element;class HashDistributionAlgorithm	extends DistributionAlgorithm implements Runnable{	int hashTimeout;	Map ipMap;	Map lastConnectTime;	Selector selector;	Thread thread;	/*	 * Because the distribution algorithms are instantiated via	 * Class.forName(), they must have public constructors.	 */	public HashDistributionAlgorithm(		Distributor distributor, Element configElement)	{		super(distributor);		/*		 * hashTimeout defines how long we keep a record of the last		 * target a given client was sent too.  Set it too long and		 * you'll use a lot of memory on a busy server.  But it needs to		 * be long enough that client sessions get sent to the right		 * server.  The right value is highly dependant on your		 * environment.  Reasonable values probably range anywhere from		 * one hour to a couple of days.	 	 */		hashTimeout = 1800000;		if (configElement.getAttribute("hash_timeout").equals(""))		{			logger.warning("No hash timeout specified, using default");		}		else		{			try			{				hashTimeout =					Integer.parseInt(						configElement.getAttribute("hash_timeout"));			}			catch (NumberFormatException e)			{				logger.warning("Invalid hash timeout, using default:  " +					e.getMessage());			}		}		logger.config("Hash timeout:  " + hashTimeout);		ipMap = new HashMap();		lastConnectTime = new HashMap();		thread = new Thread(this, getClass().getName());	}	/*	 * This allows Distributor to delay some of our initialization until	 * it is ready.  There are some things we need that Distributor may	 * not have ready at the point at which it constructs us, so we wait	 * and retrieve them at the start of run().	 */	public void startThread()	{		thread.start();	}	public void tryToConnect(SocketChannel client)	{		// See if we have an existing mapping for this client.  If so,		// and if that target is enabled, try to send the client to it.		Target target = (Target) ipMap.get(			client.socket().getInetAddress());		if (target != null)		{			logger.finer(				"Existing mapping for " +				client.socket().getInetAddress() +				" to " + target);			if (target.isEnabled())			{				initiateConnection(client, target);			}			else			{				logger.finer(					"Existing mapping for " +					client.socket().getInetAddress() +					" points to a disabled target");				// Give the client back to TargetSelector so it can try				// another distribution algorithm				targetSelector.addUnconnectedClient(client);			}		}		else		{			logger.finer(				"No existing mapping for " +				client.socket().getInetAddress());			// Give the client back to TargetSelector so it can try			// another distribution algorithm			targetSelector.addUnconnectedClient(client);		}	}	public void run()	{		List completed;		List failed;		Iterator iter;		Connection conn;		SocketChannel client;		InetAddress addr;		long lastConnect;		// Finish any initialization that was delayed until Distributor		// was ready.		finishInitialization();		while (true)		{			// Both of the checkFor*Connections() methods return lists			// we don't have to worry about synchronizing			// checkForCompletedConnections blocks in a select (with a			// timeout), which keeps us from going into a tight loop.			completed = checkForCompletedConnections();			iter = completed.iterator();			while(iter.hasNext())			{				conn = (Connection) iter.next();				targetSelector.addFinishedClient(conn);			}			failed = checkForFailedConnections();			iter = failed.iterator();			while(iter.hasNext())			{				client = (SocketChannel) iter.next();				targetSelector.addUnconnectedClient(client);			}			// Purge old entries from ipMap			synchronized(lastConnectTime)			{				iter = lastConnectTime.entrySet().iterator();				while(iter.hasNext())				{					Entry timeEntry = (Entry) iter.next();					addr = (InetAddress) timeEntry.getKey();					lastConnect = ((Long) timeEntry.getValue()).longValue();					if (lastConnect + hashTimeout < System.currentTimeMillis())					{						synchronized(ipMap)						{							ipMap.remove(addr);						}						lastConnectTime.remove(addr);					}				}			}		}	}	public void connectionNotify(Connection conn)	{		// Store a mapping for this client's IP address so that future		// connections from that IP can get sent to the same target.		synchronized(ipMap)		{			logger.finer(				"Storing mapping from " +				conn.getClient().socket().getInetAddress() +				" to " + conn.getTarget());			ipMap.put(				conn.getClient().socket().getInetAddress(),				conn.getTarget());		}		// And record the time to allow us to dump old entries from the		// maps after a while (see the run method).		synchronized(lastConnectTime)		{			lastConnectTime.put(				conn.getClient().socket().getInetAddress(),				new Long(System.currentTimeMillis()));		}	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色婷婷香蕉在线一区二区| 日韩精品视频网站| 精品成人私密视频| 日韩一级视频免费观看在线| 日韩午夜av一区| 精品国产成人系列| 久久久久久一二三区| 国产亚洲午夜高清国产拍精品| 欧美一区二区三区四区视频| 精品欧美乱码久久久久久1区2区| 精品处破学生在线二十三| 精品国产sm最大网站免费看| 久久蜜桃av一区二区天堂| 国产精品欧美经典| 一区二区三区不卡在线观看| 午夜精品福利在线| 精品在线免费视频| 国产suv精品一区二区三区| 成人动漫一区二区在线| 色哟哟国产精品| 日韩一区二区免费在线电影| 国产亚洲欧美中文| 亚洲免费观看高清完整版在线观看 | 精品久久久网站| 久久亚洲精精品中文字幕早川悠里| 国产日韩欧美不卡在线| 亚洲精品国久久99热| 日本女人一区二区三区| 国产精品一区在线| 日本精品一区二区三区高清| 日韩一级二级三级| 中文字幕中文乱码欧美一区二区| 亚洲国产精品麻豆| 国产伦精品一区二区三区视频青涩| av在线播放成人| 日韩亚洲欧美在线| 亚洲欧美一区二区三区极速播放| 亚洲v中文字幕| 粉嫩高潮美女一区二区三区| 欧美日韩午夜在线| 国产精品色哟哟网站| 日本午夜一区二区| 色综合色综合色综合色综合色综合| 欧美一级久久久| 亚洲女爱视频在线| 国产一区美女在线| 91麻豆精品国产91久久久使用方法 | 另类小说图片综合网| 91免费看视频| 久久综合九色综合97_久久久| 亚洲国产综合色| 国产精品影视天天线| 欧美挠脚心视频网站| 亚洲欧洲日韩综合一区二区| 国内外成人在线| 欧美区视频在线观看| 成人免费视频在线观看| 激情六月婷婷久久| 欧美精品一二三| 亚洲伦理在线精品| 国产伦理精品不卡| 欧美一三区三区四区免费在线看 | 亚洲美女精品一区| 国产麻豆午夜三级精品| 欧美一区二区三区不卡| 一区二区理论电影在线观看| 懂色av中文字幕一区二区三区 | 成人深夜在线观看| 久久人人超碰精品| 久久精品国产亚洲a| 日韩欧美在线一区二区三区| 偷窥少妇高潮呻吟av久久免费| 91免费版pro下载短视频| 久久精品视频在线免费观看| 美女网站一区二区| 日韩视频国产视频| 蜜桃视频在线一区| 欧美成人精品1314www| 美女一区二区三区在线观看| 日韩三区在线观看| 黄页网站大全一区二区| 精品国产人成亚洲区| 韩国女主播成人在线观看| 日韩精品在线一区二区| 美女mm1313爽爽久久久蜜臀| 欧美不卡视频一区| 国产一本一道久久香蕉| 国产欧美久久久精品影院| 福利电影一区二区三区| 国产精品久久看| 91福利社在线观看| 日韩高清不卡一区二区三区| 欧美成va人片在线观看| 国产精品一区二区三区99| 中文字幕制服丝袜成人av| 成人av手机在线观看| 亚洲欧美日韩国产成人精品影院 | 91黄色激情网站| 亚洲国产精品一区二区久久| 日韩视频国产视频| 国产精品538一区二区在线| 亚洲欧洲精品一区二区三区不卡| 一本大道久久a久久综合婷婷 | 国产精品三级av| 91社区在线播放| 日本色综合中文字幕| 久久久亚洲国产美女国产盗摄 | 亚洲欧洲日产国产综合网| 在线观看日韩av先锋影音电影院| 蜜臀va亚洲va欧美va天堂| 国产精品污网站| 欧美日韩高清影院| 国产精品一级黄| 亚洲午夜在线视频| 精品国产伦一区二区三区免费| 99精品视频一区| 激情久久久久久久久久久久久久久久| 亚洲色图制服丝袜| 日韩欧美一区二区视频| 色综合天天狠狠| 国产精品一级片在线观看| 亚洲成人第一页| 日本一区免费视频| 欧美一级理论片| 一本久久a久久免费精品不卡| 国产专区欧美精品| 午夜精品久久久久久| 亚洲欧美视频在线观看| 26uuuu精品一区二区| 欧美日韩精品三区| 91免费看片在线观看| 成人开心网精品视频| 男男视频亚洲欧美| 亚洲欧洲色图综合| 欧美国产精品中文字幕| 日韩欧美电影一区| 欧美日韩精品系列| 91福利区一区二区三区| www.久久久久久久久| 国产曰批免费观看久久久| 午夜精品影院在线观看| 亚洲精品欧美综合四区| 国产精品色哟哟| 国产午夜精品福利| 日韩精品一区二区三区中文不卡| 8v天堂国产在线一区二区| 色先锋资源久久综合| av一区二区三区| 成人av午夜影院| 不卡欧美aaaaa| 成人福利在线看| 不卡av免费在线观看| 成人做爰69片免费看网站| 国产一区二区三区四| 狠狠色综合色综合网络| 国产精品白丝jk白祙喷水网站 | 99re这里只有精品首页| 成人污污视频在线观看| 丁香婷婷综合色啪| 99r精品视频| 欧美日韩一级视频| 69堂亚洲精品首页| 日韩无一区二区| 久久久精品欧美丰满| 久久久国产综合精品女国产盗摄| 久久久亚洲国产美女国产盗摄| 久久九九99视频| 日韩一区在线看| 午夜精品久久久久久久久久久| 欧美aaaaa成人免费观看视频| 蜜桃久久久久久久| 国产寡妇亲子伦一区二区| 成人免费毛片高清视频| 91丨九色丨蝌蚪富婆spa| 欧美在线影院一区二区| 欧美美女直播网站| 精品国产凹凸成av人网站| 国产精品久久99| 亚洲一区在线视频观看| 麻豆成人91精品二区三区| 国产成人自拍网| 欧美专区日韩专区| 欧美变态tickling挠脚心| 久久精品亚洲国产奇米99| 亚洲欧美日本在线| 久久99精品国产麻豆不卡| 97国产一区二区| 91精品国产91久久久久久一区二区 | 欧美日韩精品综合在线| 欧美成人乱码一区二区三区| 国产精品成人网| 久久狠狠亚洲综合| 91色乱码一区二区三区| 欧美一区二区三区在线| 亚洲女爱视频在线| 国产又粗又猛又爽又黄91精品| 在线免费视频一区二区| 亚洲精品在线网站| 亚洲一区中文在线| youjizz久久|