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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? threadproxy.java

?? Chord package into p2psim
?? JAVA
字號:
/***************************************************************************
 *                                                                         *
 *                             ThreadProxy.java                            *
 *                            -------------------                          *
 *   date                 : 12.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 de.uniba.wiai.lspi.chord.com.CommunicationException;
import de.uniba.wiai.lspi.chord.com.Entry;
import de.uniba.wiai.lspi.chord.com.Node;
import de.uniba.wiai.lspi.chord.com.Proxy;
import de.uniba.wiai.lspi.chord.com.RefsAndEntries;
import de.uniba.wiai.lspi.chord.data.ID;
import de.uniba.wiai.lspi.chord.data.URL;
import de.uniba.wiai.lspi.util.logging.Logger;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

/**
 * This class represents a {@link Proxy} for the protocol that allows 
 * to be build a (local) chord network within one JVM. 
 * 
 * @author sven
 * @version 1.0.5
 */
public final class ThreadProxy extends Proxy {

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

	/**
	 * Reference to the {@link Registry registry}singleton.
	 */
	protected Registry registry = null;

	/**
	 * The {@link URL}of the node that created this proxy.
	 */
	protected URL creatorURL;

	/**
	 * Indicates if this proxy can be used for communication;
	 */
	protected boolean isValid = true;

	/**
	 * Indicates if this proxy has been used to make a invocation.
	 */
	protected boolean hasBeenUsed = false;

	/**
	 * The endpoint, to which this delegates method invocations. 
	 */
	private ThreadEndpoint endpoint = null;

	/**
	 * 
	 * @param creatorURL1
	 * @param url
	 * @param nodeID1
	 */
	private ThreadProxy(URL creatorURL1, URL url, ID nodeID1) {
		super(url);
		this.registry = Registry.getRegistryInstance();
		this.nodeID = nodeID1;
		this.creatorURL = creatorURL1;
	}

	/**
	 * Creates a Proxy for the <code>jchordlocal</code> protocol. The host
	 * name part of {@link URL url}is the name of the node in the
	 * <code>jchordlocal</code> protocol.
	 * @param creatorURL1 
	 * 
	 * @param url
	 *            The {@link URL}of the node this proxy represents.
	 * @throws CommunicationException 
	 */
	public ThreadProxy(URL creatorURL1, URL url) throws CommunicationException {
		super(url);
		this.registry = Registry.getRegistryInstance();
		this.creatorURL = creatorURL1;
		logger.debug("Trying to get id of node.");
		ThreadEndpoint endpoint_ = this.registry.lookup(this.nodeURL);
		logger.debug("Found endpoint " + endpoint_);
		if (endpoint_ == null) {
			throw new CommunicationException();
		}
		this.nodeID = endpoint_.getNodeID();
	}
	
	void reSetNodeID(ID id){
		this.setNodeID(id); 
	}

	/**
	 * Method to check if this proxy is valid.
	 * 
	 * @throws CommunicationException
	 */
	private void checkValidity() throws CommunicationException {

		if (!this.isValid) {
			throw new CommunicationException("No valid connection!");
		}

		if (this.endpoint == null) {
			this.endpoint = this.registry.lookup(this.nodeURL);
			if (this.endpoint == null) {
				throw new CommunicationException();
			}
		}

		/*
		 * Ensure that node id is set, if has not been set before.
		 */
		this.getNodeID();

		if (!this.hasBeenUsed) {
			this.hasBeenUsed = true;
			Registry.getRegistryInstance().addProxyUsedBy(
					this.creatorURL, this);
		}
	}

	/**
	 * Test if this Proxy is valid.
	 * 
	 * @return <code>true</code> if this Proxy is valid.
	 */
	public boolean isValid() {
		return this.isValid;
	}

	/**
	 * Invalidates this proxy.
	 * 
	 */
	public void invalidate() {
		this.isValid = false;
		this.endpoint = null;
	}

	/**
	 * Get a reference to the {@link ThreadEndpoint   endpoint} this proxy
	 * delegates methods to. If there is no endpoint a
	 * {@link CommunicationException   exception} is thrown.
	 * 
	 * @return Reference to the {@link ThreadEndpoint   endpoint} this proxy
	 *         delegates methods to.
	 * @throws CommunicationException
	 *             If there is no endpoint this exception is thrown.
	 */
	public ThreadEndpoint getEndpoint() throws CommunicationException {
		ThreadEndpoint ep = this.registry.lookup(this.nodeURL);
		if (ep == null) {
			throw new CommunicationException();
		}
		return ep;
	}

	public Node findSuccessor(ID key) throws CommunicationException {
		this.checkValidity();
		// ThreadEndpoint endpoint = this.registry.lookup(this.nodeName);
		// if (endpoint == null) {
		// throw new CommunicationException();
		// }
		Node succ = this.endpoint.findSuccessor(key);
		try {
			logger.debug("Creating clone of proxy " + succ);
			ThreadProxy temp = (ThreadProxy) succ;
			logger.debug("Clone created");
			return temp.cloneMeAt(this.creatorURL);
		} catch (Throwable t) {
			logger.debug("Exception during clone of proxy.", t);
			throw new CommunicationException(t);
		}
	}

	public void insertEntry(Entry entry) throws CommunicationException {
		this.checkValidity();
		logger.debug("Trying to execute insert().");
		// ThreadEndpoint endpoint = this.registry.lookup(this.nodeName);
		logger.debug("Found endpoint " + this.endpoint);
		// if (endpoint == null) {
		// throw new CommunicationException();
		// }
		this.endpoint.insertEntry(entry);
		logger.debug("insert() executed");
	}

	public void removeEntry(Entry entry) throws CommunicationException {
		this.checkValidity();
		this.endpoint.removeEntry(entry);
	}

	/**
	 * 
	 */
	public String toString() {
		StringBuilder buffer = new StringBuilder();
		buffer.append("[ThreadProxy ");
		buffer.append(this.nodeURL);
		buffer.append("]");
		return buffer.toString();
	}

	public List<Node> notify(Node potentialPredecessor)
			throws CommunicationException {
		this.checkValidity();

		ThreadProxy potentialPredecessorProxy = new ThreadProxy(
				this.creatorURL, potentialPredecessor.getNodeURL());

		logger.debug("Trying to execute notify().");
		// ThreadEndpoint endpoint = this.registry.lookup(this.nodeName);
		logger.debug("Found endpoint " + this.endpoint);
		// if (endpoint == null) {
		// throw new CommunicationException();
		// }
		List<Node> nodes = this.endpoint.notify(potentialPredecessorProxy);
		Node[] proxies = new Node[nodes.size()];
		try {
			int currentIndex = 0;
			// TODO Document why ThreadProxy instead of Node
			for (Iterator<Node> i = nodes.iterator(); i.hasNext();) {
				Object o = i.next();
				ThreadProxy current = (ThreadProxy) o;
				proxies[currentIndex++] = current.cloneMeAt(this.creatorURL);
			}
		} catch (Throwable t) {
			throw new CommunicationException(t);
		}
		return Arrays.asList(proxies);
	}

	public void ping() throws CommunicationException {
		this.checkValidity();
		logger.debug("Trying to execute ping().");
		logger.debug("Found endpoint " + this.endpoint);
		this.endpoint.ping();
	}

	public Set<Entry> retrieveEntries(ID id) throws CommunicationException {
		this.checkValidity();
		logger.debug("Trying to execute retrieve().");
		logger.debug("Found endpoint " + this.endpoint);
		return this.endpoint.retrieveEntries(id);
	}

	/**
	 * Creates a copy of this. 
	 * 
	 * @param creatorUrl The url of the node where this is being copied. 
	 * @return The copy of this. 
	 */
	private ThreadProxy cloneMeAt(URL creatorUrl) {
		return new ThreadProxy(creatorUrl, this.nodeURL, this.nodeID);
	}

	public void leavesNetwork(Node predecessor) throws CommunicationException {
		this.checkValidity();

		ThreadProxy predecessorProxy = new ThreadProxy(this.creatorURL,
				predecessor.getNodeURL());

		logger.debug("Trying to execute leavesNetwork(" + predecessor + ").");
		// ThreadEndpoint endpoint = this.registry.lookup(this.nodeName);
		logger.debug("Found endpoint " + this.endpoint);
		// if (endpoint == null) {
		// throw new CommunicationException();
		// }
		this.endpoint.leavesNetwork(predecessorProxy);
	}

	public void removeReplicas(ID sendingNodeID, Set<Entry> entriesToRemove)
			throws CommunicationException {
		this.checkValidity();
		logger.debug("Trying to execute removeReplicas(" + entriesToRemove
				+ ").");
		// ThreadEndpoint endpoint = this.registry.lookup(this.nodeName);
		logger.debug("Found endpoint " + this.endpoint);
		// if (endpoint == null) {
		// throw new CommunicationException();
		// }
		this.endpoint.removeReplicas(sendingNodeID, entriesToRemove);
	}

	public void insertReplicas(Set<Entry> entries)
			throws CommunicationException {
		this.checkValidity();
		logger.debug("Trying to execute insertReplicas(" + entries + ").");
		// ThreadEndpoint endpoint = this.registry.lookup(this.nodeName);
		logger.debug("Found endpoint " + this.endpoint);
		// if (endpoint == null) {
		// throw new CommunicationException();
		// }
		this.endpoint.insertReplicas(entries);
	}

	public RefsAndEntries notifyAndCopyEntries(Node potentialPredecessor)
			throws CommunicationException {
		this.checkValidity();

		ThreadProxy potentialPredecessorProxy = new ThreadProxy(
				this.creatorURL, potentialPredecessor.getNodeURL());

		logger.debug("Trying to execute notifyAndCopyEntries().");
		// ThreadEndpoint endpoint = this.registry.lookup(this.nodeName);
		logger.debug("Found endpoint " + this.endpoint);
		// if (endpoint == null) {
		// throw new CommunicationException();
		// }
		return this.endpoint.notifyAndCopyEntries(potentialPredecessorProxy);
	}

	@Override
	public void disconnect() {
		// TODO Auto-generated method stub
		
	}

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91丨九色丨尤物| 99在线精品观看| 亚洲精品视频免费观看| 制服视频三区第一页精品| 北条麻妃国产九九精品视频| 丁香婷婷深情五月亚洲| 首页国产丝袜综合| 中文字幕在线免费不卡| 精品国产污污免费网站入口| 在线精品视频一区二区三四| 国产99久久精品| 美女脱光内衣内裤视频久久影院| 亚洲欧美电影一区二区| 久久久精品国产99久久精品芒果| 欧美日韩一区久久| 色综合天天综合网天天看片| 国产福利一区二区三区视频在线| 日本免费在线视频不卡一不卡二| 一区二区三区四区乱视频| 欧美韩国一区二区| 26uuu国产日韩综合| 欧美精品在线观看一区二区| 在线观看视频欧美| 色综合夜色一区| 菠萝蜜视频在线观看一区| 久久99精品国产麻豆婷婷| 琪琪一区二区三区| 丝袜美腿亚洲色图| 偷拍自拍另类欧美| 天涯成人国产亚洲精品一区av| 亚洲激情六月丁香| 亚洲精品第1页| 一区二区三区在线影院| 亚洲日本青草视频在线怡红院| 国产精品水嫩水嫩| 国产精品毛片大码女人| 欧美激情自拍偷拍| 中文av一区二区| 最近中文字幕一区二区三区| 成人免费在线播放视频| 亚洲天堂精品视频| 成人av免费在线| 91视频在线观看| 99久精品国产| 在线观看日产精品| 欧美日韩综合不卡| 欧美老年两性高潮| 日韩一级在线观看| 久久综合精品国产一区二区三区| 久久精品在这里| 国产精品不卡视频| 亚洲免费观看在线视频| 亚洲国产视频直播| 日本不卡一区二区三区| 免费观看在线色综合| 国产一区二区在线看| 成人av电影在线播放| 91农村精品一区二区在线| 欧洲视频一区二区| 日韩一级大片在线| 国产亚洲福利社区一区| 国产精品激情偷乱一区二区∴| 日韩理论片网站| 日韩电影在线观看一区| 国模冰冰炮一区二区| 成人av动漫网站| 欧美日韩国产在线观看| 精品国产一区二区国模嫣然| 国产精品嫩草影院com| 一区二区三区欧美| 久热成人在线视频| 91在线视频免费观看| 欧美日韩国产高清一区二区| 精品精品国产高清a毛片牛牛 | 亚洲va国产天堂va久久en| 三级欧美韩日大片在线看| 国产精品一级二级三级| 色综合网站在线| 精品久久一区二区三区| 国产精品传媒入口麻豆| 天天色综合天天| 国产成人av电影| 欧美日韩另类国产亚洲欧美一级| 精品成人免费观看| 亚洲综合一二区| 国产一二三精品| 欧美亚洲综合另类| 中文字幕国产一区| 日本免费新一区视频| 91亚洲精华国产精华精华液| 欧美一区二区三区影视| 亚洲乱码国产乱码精品精可以看| 久久精品免费看| 欧美无砖砖区免费| 久久久久久一级片| 午夜精品视频在线观看| 不卡av在线免费观看| 日韩精品一区二区三区swag| 一区二区三区中文字幕精品精品 | 国产寡妇亲子伦一区二区| 色综合久久天天综合网| 久久亚洲影视婷婷| 日韩国产在线一| 欧洲av一区二区嗯嗯嗯啊| 欧美国产激情二区三区| 精品在线视频一区| 在线不卡的av| 一区二区三区中文字幕精品精品 | 另类中文字幕网| 欧美日韩一卡二卡三卡| 国产精品国产成人国产三级| 国产精品原创巨作av| 91精品欧美一区二区三区综合在| 亚洲女厕所小便bbb| 国产成人精品综合在线观看 | 99re成人在线| 中文在线资源观看网站视频免费不卡| 免费不卡在线视频| 欧美一区三区二区| 丝袜美腿亚洲一区| 欧美区一区二区三区| 亚洲在线视频网站| 一本一道久久a久久精品 | 亚洲一二三区在线观看| 972aa.com艺术欧美| 国产精品另类一区| 成人看片黄a免费看在线| 国产亚洲精品bt天堂精选| 国产在线播放一区三区四| 日韩亚洲电影在线| 美女网站在线免费欧美精品| 日韩一区二区影院| 日韩成人精品在线| 欧美一区三区二区| 另类专区欧美蜜桃臀第一页| 精品免费国产二区三区| 欧美日韩国产综合视频在线观看| 亚洲一区在线观看视频| 欧美午夜精品一区| 偷偷要91色婷婷| 日韩天堂在线观看| 国内欧美视频一区二区| 精品久久久久99| 国产一区在线精品| 国产精品免费视频一区| 91亚洲永久精品| 一二三四区精品视频| 欧美三级日韩三级| 日韩福利视频网| 精品999在线播放| 国产成人免费xxxxxxxx| 亚洲天堂av老司机| 欧美日韩黄色影视| 极品少妇一区二区| 国产女人水真多18毛片18精品视频| 成人综合婷婷国产精品久久蜜臀 | 亚洲最大成人网4388xx| 欧美日韩在线播| 久久69国产一区二区蜜臀| 久久久电影一区二区三区| 99久久综合精品| 亚洲1区2区3区视频| 精品国产免费久久| 91小视频在线观看| 婷婷激情综合网| 久久免费午夜影院| 91福利精品视频| 韩国精品久久久| 亚洲欧美日韩国产中文在线| 欧美二区三区的天堂| 国产一区二区影院| 亚洲一区二区三区激情| 欧美精品一区二区在线播放| av一区二区三区四区| 午夜国产精品影院在线观看| 久久免费电影网| 欧美亚洲动漫精品| 国产91精品精华液一区二区三区| 亚洲乱码国产乱码精品精小说| 日韩亚洲欧美中文三级| 成人av免费观看| 久久www免费人成看片高清| 最新国产の精品合集bt伙计| 日韩一级视频免费观看在线| eeuss鲁片一区二区三区在线看| 亚洲国产精品人人做人人爽| 久久久精品影视| 91精品国产色综合久久ai换脸 | 免费人成精品欧美精品| 国产精品国产三级国产aⅴ原创| 91精品国产综合久久精品图片| 高清不卡一二三区| 免费在线观看日韩欧美| 亚洲免费av在线| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 亚洲欧美偷拍卡通变态| 精品国产伦一区二区三区观看体验| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 国产精品久久久久婷婷| 精品剧情在线观看|