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

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

?? httpcookiedistributionalgorithm.java.temp

?? 簡單的分布式算法
?? TEMP
字號:
/* ***************************************************************************** * $Id$ ***************************************************************************** * A distribution algorithm which ensures clients speak to a * consistent server.  Similar in effect to a hash selection algorithm * but implemented by feeding the client an HTTP cookie which records * the target that the client is connected to.  Obviously only works for * HTTP servers, but provides a better distribution than a standard hash * algorithm because many clients behind a web proxy or NAT router don't * all get stuck on 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.HashMap;import java.nio.ByteBuffer;import java.nio.channels.SocketChannel;class HTTPCookieDistributionAlgorithm	extends DistributionAlgorithm implements Runnable{	Map clientHeaderBuffers;	int hashTimeout;	Map ipMap;	Map lastConnectTime;	static final int DEFAULT_HEADER_BUFFER_SIZE = 4096;	int maxHeaderSize;	Thread thread;	/*	 * Because the distribution algorithms are instantiated via	 * Class.forName(), they must have public constructors.	 */	public HTTPCookieDistributionAlgorithm(		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;		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);		// ***		// Need to read this from configElement		maxHeaderSize = 32768;		clientHeaderBuffers = new HashMap();		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();	}	// On a new connection we need to look for a cookie in the HTTP	// headers.  If there is one we prefer that target, just like the	// hash algorithm (i.e. prefer that target and fail back to round	// robin if the preferred target is down).  If there isn't a cookie,	// or if the preferred target is unavailable and we connect the	// client to a new target, we set a cookie in the return traffic.	// http://wp.netscape.com/newsref/std/cookie_spec.html	//	// Possible cookie fields and defaults:	// expires		User's session	// domain		Server hostname	// path			Document path	// secure		No	//	// We need a cookie as follows	// Set-Cookie: DistributorTarget=<target> path=/	// The HTTP RFC (2616) says headers are US-ASCII, so we need to	// specify that as the charset for Java to use when decoding strings	// from the input stream.	public void tryToConnect(SocketChannel client)	{		clientHeaderBuffers.put(			client,			ByteBuffer.allocate(DEFAULT_HEADER_BUFFER_SIZE));		// ***		// Register with selector	}	public void run()	{		List failed;		Iterator iter;		SocketChannel client;		// Finish any initialization that was delayed until Distributor		// was ready.		finishInitialization();		while(true)		{			// ***			select			{				foreach sockchan				{					while (readMore)					{						ByteBuffer buf = clientHeaderBuffers.get(sockchan);						// Bump the buffer's limit by one, thus allowing						// read() to read one byte						buf.limit(buf.position() + 1);						r = sockchan.read(buf);						if (r == 1)						{							// Ignore leading CRLF's per							// section 4.1 of RFC 2616							// ***							if (buf.position() == 1)							{							}							//							// Look for end of headers							//							// Grab the last 4 bytes of the buffer							byte[] lastBit = new byte[4];							// Back the buffer position up by 3 so we							// get 4 bytes							buf.position(buf.position() - 3);							buf.get(lastBit);							// Restore the buffer position							buf.position(buf.position() + 3);							// The end of the headers will be signified							// by CRLFCRLF, i.e. a start/header line							// followed by a blank line.							if (lastBit[0] == '\r' &&								lastBit[1] == '\n' &&								lastBit[2] == '\r' &&								lastBit[3] == '\n')							{							}						}						else if (r == 0)						{							// No more data can be read for now, but							// we still haven't seen the end of the							// headers.  Ratchet the buffer's limit							// back by one so it's ready for the next							// time around.							buf.limit(buf.position());						}						else if (r == -1)						{							// EOF encountered but end of headers not							// found.  This connection is bogus, discard							// it.						}					}				}			}			// Give any failed connections back to TargetSelector			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);					}				}			}			// ***			logger.fine("connections.size():  " + connections.size());			logger.fine("connectStartTime.size():  " + connectStartTime.size());			logger.fine("ipMap.size():  " + ipMap.size());			logger.fine("lastConnectTime.size():  " + lastConnectTime.size());		}	}	public void connectionNotify(Connection conn)	{		// Store a mapping for this client's IP address so that we can		// inject the appropriate cookie later		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()));		}	}	// If we have any data queued up from the cookie search, prepend it	public ByteBuffer reviewClientToServerData(		SocketChannel client, SocketChannel server, ByteBuffer buffer)	{		// ***	}	// Inject a Set-Cookie header if appropriate	public ByteBuffer reviewServerToClientData(		SocketChannel server, SocketChannel client, ByteBuffer buffer)	{		// ***	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人综合婷婷国产精品久久蜜臀| 成人手机在线视频| 国产丝袜在线精品| 欧美在线啊v一区| 国产在线精品视频| 亚洲成av人综合在线观看| 国产女人aaa级久久久级 | 日韩精品中文字幕在线不卡尤物 | 91精品婷婷国产综合久久性色| 国产91综合网| 麻豆精品在线看| 亚洲精品中文在线影院| 久久久久国产成人精品亚洲午夜| 欧美日韩精品高清| av在线播放不卡| 经典三级视频一区| 天天做天天摸天天爽国产一区| 中文字幕中文字幕中文字幕亚洲无线| 日韩欧美亚洲国产另类| 欧美中文字幕久久| 成人app网站| 国产福利一区二区三区视频 | 精品在线免费观看| 视频一区国产视频| 玉米视频成人免费看| 国产精品美女一区二区| 26uuu精品一区二区| 91精品国产色综合久久ai换脸| 在线视频欧美区| 欧美性感一类影片在线播放| 成人美女在线视频| 国产成人三级在线观看| 国产精品一二三在| 国产伦精品一区二区三区在线观看| 日韩精品久久理论片| 天天影视涩香欲综合网| 亚洲午夜成aⅴ人片| 亚洲午夜在线观看视频在线| 亚洲免费观看高清完整版在线| 国产精品麻豆视频| 亚洲欧洲日产国码二区| 国产精品美女一区二区在线观看| 欧美国产欧美亚州国产日韩mv天天看完整| 日韩一区二区三区免费看| 91精品久久久久久久久99蜜臂 | 久久综合久久综合久久| 久久色中文字幕| 精品sm捆绑视频| 久久久久久久久久久久久女国产乱| 欧美成人精品高清在线播放| 久久综合丝袜日本网| 久久久99精品久久| 国产精品拍天天在线| 综合精品久久久| 一区二区三区中文在线| 亚洲va欧美va人人爽| 天天色综合天天| 久久99久久久久| 国产精品自拍毛片| 成人av网在线| 91成人网在线| 日韩视频一区二区在线观看| 欧美成人一区二区三区片免费 | 亚洲成人资源在线| 蜜臀av性久久久久蜜臀aⅴ流畅 | 成人永久免费视频| 色狠狠av一区二区三区| 欧美日韩1234| 26uuu欧美日本| 亚洲综合久久av| 蜜乳av一区二区三区| 国产精品一区专区| 91网站最新地址| 日韩一区二区三区电影| 国产人伦精品一区二区| 一区二区三区**美女毛片| 日韩福利电影在线| 国产成人av电影| 欧美系列亚洲系列| 欧美精品一区二区三区高清aⅴ | 亚洲一区二区三区在线看| 男人的天堂亚洲一区| 国产乱码精品一区二区三区忘忧草| 99久久免费精品| 欧美一区二区国产| 自拍偷拍亚洲综合| 免费欧美日韩国产三级电影| 大美女一区二区三区| 欧美精品一卡二卡| 国产精品天美传媒沈樵| 视频一区二区三区中文字幕| 国产91精品久久久久久久网曝门| 欧美视频在线观看一区二区| 亚洲精品在线观看视频| 亚洲欧美乱综合| 国产一区二区导航在线播放| 色婷婷亚洲综合| 久久综合久久综合九色| 亚洲国产精品久久艾草纯爱| 国产激情精品久久久第一区二区| 欧美亚洲国产一卡| 中文天堂在线一区| 蜜臀国产一区二区三区在线播放| 91色综合久久久久婷婷| 精品国产一区二区三区av性色 | 日本韩国精品一区二区在线观看| 精品va天堂亚洲国产| 香蕉久久一区二区不卡无毒影院 | 亚洲在线视频免费观看| 欧洲一区在线电影| 中文字幕电影一区| 麻豆视频观看网址久久| 欧美亚洲另类激情小说| 亚洲欧美在线视频观看| 国产精品一二三区在线| 日韩视频永久免费| 丝袜美腿一区二区三区| 欧美在线啊v一区| 综合网在线视频| 成人国产电影网| 国产日韩欧美激情| 国产精品资源在线看| 日韩三级电影网址| 婷婷久久综合九色综合伊人色| 91蜜桃网址入口| 国产精品色呦呦| 国产二区国产一区在线观看| 精品国产一区二区国模嫣然| 青青草原综合久久大伊人精品优势 | 日本中文字幕一区| 欧美性大战xxxxx久久久| 亚洲乱码国产乱码精品精的特点 | 精品制服美女久久| 日韩一区二区精品| 免费在线欧美视频| 欧美一区日韩一区| 午夜国产精品影院在线观看| 欧美色综合影院| 亚洲不卡av一区二区三区| 在线观看不卡一区| 亚洲一区二区三区四区在线观看 | yourporn久久国产精品| 国产精品色婷婷| 不卡视频一二三| 国产精品久久久久影视| av在线不卡网| 亚洲精品大片www| 欧美系列亚洲系列| 舔着乳尖日韩一区| 欧美一级视频精品观看| 久久av资源网| 国产亚洲人成网站| 午夜精品福利在线| 欧美一级久久久| 久久99九九99精品| 国产亚洲成年网址在线观看| 成人看片黄a免费看在线| 国产精品久久久久久户外露出| av一区二区三区| 一级特黄大欧美久久久| 宅男在线国产精品| 国产一区视频在线看| 国产精品白丝在线| 欧美色精品在线视频| 麻豆91免费观看| 亚洲国产电影在线观看| 91麻豆免费视频| 日韩电影在线免费| 久久先锋资源网| 99久久精品国产毛片| 午夜精品久久久久久久99水蜜桃| 日韩一区二区中文字幕| 欧美精品日韩一区| 激情国产一区二区| 亚洲欧洲99久久| 欧美精品色综合| 粉嫩嫩av羞羞动漫久久久 | 蜜桃精品视频在线观看| 国产欧美一区二区三区网站| 欧洲精品一区二区三区在线观看| 美女视频黄免费的久久| 国产精品久久久久四虎| 88在线观看91蜜桃国自产| 国产精品99久久久久久有的能看| 悠悠色在线精品| 精品国产免费一区二区三区香蕉| 成人福利电影精品一区二区在线观看| 亚洲国产精品精华液网站| 国产亚洲一区二区在线观看| 欧美日韩综合不卡| 国产不卡在线一区| 午夜精品久久久久久久久久久| 国产视频亚洲色图| 91精品国产综合久久久久久久 | 国产91精品精华液一区二区三区| 午夜视频在线观看一区二区| 国产欧美一区二区三区网站| 9191成人精品久久| 91免费国产在线观看| 国产一区二区h|