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

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

?? registry.java

?? Chord package into p2psim
?? JAVA
字號:
/***************************************************************************
 *                                                                         *
 *                              Registry.java                              *
 *                            -------------------                          *
 *   date                 : 16.08.2004                                     *
 *   copyright            : (C) 2004-2008 Distributed and                  *
 *                              Mobile Systems Group                       *
 *                              Lehrstuhl fuer Praktische Informatik       *
 *                              Universitaet Bamberg                       *
 *                              http://www.uni-bamberg.de/pi/              *
 *   email                : sven.kaffille@uni-bamberg.de                   *
 *                          karsten.loesing@uni-bamberg.de                 *
 *                                                                         *
 *                                                                         *
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program 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.                                   *
 *                                                                         *
 *   A copy of the license can be found in the license.txt file supplied   *
 *   with this software or at: http://www.gnu.org/copyleft/gpl.html        *
 *                                                                         *
 ***************************************************************************/
 
package de.uniba.wiai.lspi.chord.com.local;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import de.uniba.wiai.lspi.chord.data.URL;
import de.uniba.wiai.lspi.util.logging.Logger;

/**
 * This class represents a registry for {@link ThreadEndpoint endpoints}that
 * can be used to build up a chord network within the same JVM with help of Java
 * Threads. This Registry is a singleton so that there is only one instance of
 * this in the JVM. A reference to the singleton can be obtained by invocation
 * of {@link #getRegistryInstance()}.
 * 
 * @author sven
 * @version 1.0.5
 */
public final class Registry {

	/**
	 * Logger for instances of this. 
	 */
	private final static Logger logger = Logger.getLogger(Registry.class.getName());

	/**
	 * Reference to the registry singleton.
	 */
	private static Registry registry;

	/**
	 * Stores the references to the registered   {@ThreadEndpoint   endpoints}  .
	 */
	private Map<URL, ThreadEndpoint> registeredEndpoints = new HashMap<URL, ThreadEndpoint>();

	// TODO Hashtable for synchronization?

	/**
	 * Stores references to the proxies in use by nodes. Key:   {@link String}  (name of node), Value:   {@link List}  of   {@link ThreadProxy   proxies}.
	 */
	private Map<URL, List<ThreadProxy>> proxiesInUse = new HashMap<URL, List<ThreadProxy>>();

	// TODO Hashtable for synchronization?

	/**
	 * Create an instance of Reqistry.
	 */
	private Registry() {
		/* nothing to do here */
	}

	/**
	 * Add the given proxy used by the node with <code>nodeName</code>.
	 * 
	 * @param url
	 *            The url of the node that uses the proxy.
	 * @param proxy
	 *            The {@link ThreadProxy proxy}to add.
	 */
	public void addProxyUsedBy(URL url, ThreadProxy proxy) {
		if (!this.registeredEndpoints.containsKey(url)) {
			return;
		}
		List<ThreadProxy> pList = this.proxiesInUse.get(url);
		if (pList == null) {
			pList = new LinkedList<ThreadProxy>();
		}
		pList.add(proxy);
		this.proxiesInUse.put(url, pList);
	}

	/**
	 * Get a reference to the {@link List}of proxies used by the node with
	 * <code>nodeName</code>.
	 * 
	 * @param url
	 *            The url of the node.
	 * @return {@link List}of {@link ThreadProxy proxies}that are used by the
	 *         node with <code>nodeName</code>. May return <code>null</code>
	 *         if there are no proxies in use by the node.
	 */
	public List<ThreadProxy> getProxiesInUseBy(URL nodeName) {
		logger.debug("getProxiesInUseBy(" + nodeName + ")");
		return this.proxiesInUse.get(nodeName);
	}

	/**
	 * Removes the {@link ThreadProxy proxies} used by the node 
	 * with <code>nodeName</code>. 
	 * 
	 * @param url The url of the node, for that the proxies 
	 * should be removed. 
	 */
	public void removeProxiesInUseBy(URL nodeName) {
		logger.debug("removeProxiesInUseBy(" + nodeName + ")");
		this.proxiesInUse.remove(nodeName);
	}

	/**
	 * Register the given {@link ThreadEndpoint endpoint}so that it can be
	 * looked up via {@link #lookup(String)}.
	 * 
	 * @param endpoint
	 *            The {@link ThreadEndpoint}to register.
	 */
	public void bind(ThreadEndpoint endpoint) {
		URL name = endpoint.getURL();
		logger.debug("Binding endpoint: " + endpoint + "with name " + name);
		/* if there is not already an endpoint for that name */
		Object temp = this.registeredEndpoints.get(name);
		if (temp == null) {
			/* bind given endpoint to name */
			this.registeredEndpoints.put(name, endpoint);
			logger.debug("Endpoint " + endpoint + " bound.");
		} else {
			logger.warn("Endpoint " + endpoint + " NOT BOUND!!! " + temp
					+ " already registered under " + name);
		}
	}

	/**
	 * Remove the given {@link ThreadEndpoint endpoint}from the registry.
	 * 
	 * @param endpoint
	 *            {@link ThreadEndpoint}to remove.
	 */
	public void unbind(ThreadEndpoint endpoint) {
		logger.debug("Unbinding endpoint: " + endpoint);
		this.registeredEndpoints.remove(endpoint.getURL());
		logger.debug("Endpoint " + endpoint + " removed from registry.");
	}

	/**
	 * This method looks up the {@link ThreadEndpoint endpoint}for the
	 *  node with the given
	 * name. If no endpoint is found <code>null</code> is returned.
	 * 
	 * @param url
	 *            The url of the node, for which the
	 *            {@link ThreadEndpoint endpoint}is looked up.
	 * 
	 * @return Reference to the {@link ThreadEndpoint endpoint}of node with
	 *         name "<code>name</code>". May be <code>null</code> if no
	 *         such reference exists.
	 */
	public ThreadEndpoint lookup(URL url) {
		logger.debug("Looking up endpoint for " + url);
		ThreadEndpoint ep = this.registeredEndpoints.get(url);
		logger.debug("Endpoint for " + url + ": " + ep);
		return ep;
	}

	/**
	 * Returns an array of all registered endpoints.
	 * 
	 * @return Array of all registered {@link ThreadEndpoint endpoints}. If no
	 *         endpoint is registered an array of length 0 is returned.
	 */
	public Map<URL, ThreadEndpoint> lookupAll() {
		return this.registeredEndpoints;
		/*
		 * synchronized (this.registeredEndpoints){ ThreadEndpoint[] endpoints =
		 * new ThreadEndpoint[registeredEndpoints.size()]; Iterator iterator =
		 * this.registeredEndpoints.values().iterator(); int index = 0; while
		 * (iterator.hasNext()) { endpoints[index] =
		 * (ThreadEndpoint)iterator.next(); index++; } return endpoints; }
		 */
	}

	/**
	 * Get a reference to the registry singleton.
	 * This method is not thread-safe!
	 * 
	 * @return Reference to the registry singleton.
	 */
	public static Registry getRegistryInstance() {
		if (registry == null) {
			logger.debug("Creating registry singleton. ");
			registry = new Registry();
			logger.debug("Registry singleton created. ");
		}
		return registry;
	}

	/**
	 * Overwritten from {@link java.lang.Object}. 
	 * 
	 * @return String representation of this. 
	 */
	public String toString() {
		StringBuilder buffer = new StringBuilder();
		buffer.append("[Singleton registry of ThreadEndpoints ");
		buffer.append("with ");
		buffer.append(this.registeredEndpoints.size());
		buffer.append(" endpoints registered]");
		return buffer.toString();
	}
	
	/**
	 * Shutdown this registry. 
	 */
	public void shutdown(){
		for (ThreadEndpoint endpoint : this.registeredEndpoints.values()) {
			endpoint.crash(); 
		} 
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人黄色片在线观看| 图片区小说区国产精品视频| 国产自产2019最新不卡| 91麻豆精品国产91久久久久久久久 | voyeur盗摄精品| 国产三区在线成人av| 国产宾馆实践打屁股91| 亚洲欧洲国产日韩| 色欧美日韩亚洲| 图片区小说区区亚洲影院| 欧美一区二区三区视频免费| 乱中年女人伦av一区二区| 久久综合九色综合欧美98| 国产成人综合在线播放| 国产精品久久久久桃色tv| 97久久精品人人澡人人爽| 亚洲成年人网站在线观看| 欧美一区二区三区思思人| 国产精品18久久久久久久久 | 精品电影一区二区| 国产91精品免费| 一区二区三区欧美亚洲| 日韩情涩欧美日韩视频| 成人亚洲一区二区一| 一区二区在线免费| 久久综合九色综合欧美98| 99精品欧美一区二区三区小说| 亚洲一区视频在线观看视频| 精品91自产拍在线观看一区| 91小视频免费看| 久久国产精品72免费观看| 国产精品久久久99| 欧美精品丝袜久久久中文字幕| 黄页视频在线91| 伊人色综合久久天天| 久久婷婷成人综合色| 在线视频一区二区三区| 国产成人精品一区二区三区网站观看| 亚洲乱码精品一二三四区日韩在线| 在线播放中文字幕一区| 成人福利电影精品一区二区在线观看| 亚洲高清不卡在线| 国产精品美女久久久久久久久| 欧美一区在线视频| 在线这里只有精品| 国产很黄免费观看久久| 免费在线看成人av| 亚洲伦在线观看| 亚洲国产精品99久久久久久久久| 欧美日韩成人综合天天影院| eeuss鲁片一区二区三区| 免费在线一区观看| 亚洲国产精品嫩草影院| 国产精品久久久久9999吃药| 26uuu精品一区二区| 欧美日本免费一区二区三区| 91色.com| 成人av在线网| 国产黄色精品视频| 韩国成人精品a∨在线观看| 午夜视频在线观看一区二区三区| 亚洲欧美中日韩| 久久免费电影网| 欧美r级在线观看| 欧美一区二区三区人| 欧美午夜片在线观看| 91色视频在线| 99久久精品国产精品久久| 国产成人av自拍| 国产高清亚洲一区| 久久成人免费网| 麻豆91精品91久久久的内涵| 丝袜脚交一区二区| 午夜日韩在线电影| 亚洲国产日日夜夜| 午夜视频一区二区三区| 亚洲国产欧美在线| 日日噜噜夜夜狠狠视频欧美人| 亚洲精品成人少妇| 亚洲高清视频中文字幕| 肉色丝袜一区二区| 日韩中文字幕1| 日本不卡高清视频| 极品少妇一区二区| 国产电影一区二区三区| 国产精品12区| 91片黄在线观看| 91蝌蚪porny| 欧美三级三级三级| 欧美精品欧美精品系列| 久久精品日产第一区二区三区高清版| 精品福利一区二区三区免费视频| 精品少妇一区二区三区免费观看| 日韩情涩欧美日韩视频| 欧美精品一区二区在线播放| 国产亚洲一区二区三区| 中文字幕一区二区三区四区| 亚洲图片另类小说| 亚洲福利视频导航| 精品在线观看视频| 成人手机在线视频| 91黄色激情网站| 精品区一区二区| 国产精品欧美久久久久无广告| 亚洲色图.com| 日韩成人免费在线| 国产激情偷乱视频一区二区三区| 99re这里都是精品| 欧美一级片免费看| 中文字幕乱码亚洲精品一区| 亚洲人成人一区二区在线观看| 午夜成人免费视频| 国产成a人亚洲精| 在线亚洲免费视频| 久久婷婷成人综合色| 亚洲三级在线播放| 久久99最新地址| 91精彩视频在线观看| 欧美zozo另类异族| 一区二区国产视频| 国产剧情一区二区| 欧美日韩亚洲另类| 国产欧美一区二区精品仙草咪| 亚洲午夜免费电影| 国产精品一区二区久久精品爱涩| 在线视频一区二区免费| 亚洲精品在线免费观看视频| 亚洲美女屁股眼交3| 狠狠网亚洲精品| 欧美狂野另类xxxxoooo| 国产精品乱人伦中文| 日韩电影免费在线看| 一本色道久久综合亚洲精品按摩| 日韩女优视频免费观看| 亚洲一区二区三区中文字幕| 国产九九视频一区二区三区| 欧美巨大另类极品videosbest | 中文字幕第一页久久| 香蕉成人啪国产精品视频综合网 | 亚洲乱码一区二区三区在线观看| 美女在线视频一区| 欧美性色aⅴ视频一区日韩精品| 国产欧美日韩亚州综合| 麻豆91在线播放免费| 欧美日韩视频不卡| 亚洲激情综合网| 99免费精品视频| 久久久精品免费观看| 久久精品国产精品青草| 欧美日韩高清影院| 亚洲伊人色欲综合网| 99精品在线观看视频| 国产女主播一区| 国产一区二区中文字幕| 精品久久五月天| 日韩av在线播放中文字幕| 欧洲精品一区二区三区在线观看| 国产精品黄色在线观看| 国产成+人+日韩+欧美+亚洲| 久久亚区不卡日本| 国产成人免费在线视频| 久久综合九色综合97婷婷| 黄色日韩网站视频| 精品免费国产一区二区三区四区| 视频一区二区三区入口| 欧美高清www午色夜在线视频| 夜夜嗨av一区二区三区| 在线影视一区二区三区| 一区二区高清免费观看影视大全| 成人久久18免费网站麻豆| 久久久久久一二三区| 国产成人小视频| 国产精品免费aⅴ片在线观看| 国产成人在线影院| 国产精品理论片| 9i看片成人免费高清| 亚洲视频免费观看| 欧美亚洲国产bt| 日本怡春院一区二区| 7777精品伊人久久久大香线蕉| 日本成人中文字幕| 日韩欧美一二区| 国产精品一色哟哟哟| 国产午夜亚洲精品午夜鲁丝片 | jlzzjlzz亚洲日本少妇| 亚洲欧美韩国综合色| 日本丰满少妇一区二区三区| 亚洲综合激情网| 日韩精品一区二区三区swag| 国产精品一区二区x88av| 国产精品久久久久久久久免费相片 | 精品夜夜嗨av一区二区三区| 欧美精品一区男女天堂| 不卡的av电影在线观看| 亚洲黄色录像片| 91.xcao| 国产成人啪午夜精品网站男同| 综合亚洲深深色噜噜狠狠网站| 欧美性猛交xxxxxxxx| 看片的网站亚洲|