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

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

?? threadendpoint.java

?? Chord package into p2psim
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/***************************************************************************
 *                                                                         *
 *                            ThreadEndpoint.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 java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

import de.uniba.wiai.lspi.chord.com.CommunicationException;
import de.uniba.wiai.lspi.chord.com.Endpoint;
import de.uniba.wiai.lspi.chord.com.Entry;
import de.uniba.wiai.lspi.chord.com.Node;
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.chord.service.impl.ChordImpl;
import de.uniba.wiai.lspi.util.logging.Logger;

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

	/**
	 * The logger for this instance.
	 */
	private Logger logger = null;

	/**
	 * Constant indicating that this has crashed.
	 */
	private final static int CRASHED = Integer.MAX_VALUE;

	/**
	 * The {@link Registry registry}of local endpoints.
	 */
	protected final Registry registry;

	/**
	 * Object to synchronize threads at. Used to block and wake up threads that
	 * are waiting for this endpoint to get into a state.
	 */
	private Object lock = new Object();

	/**
	 * {@link List}of {@link InvocationListener listeners}that want to be
	 * notified if a method is invoked on this endpoint.
	 */
	protected List<InvocationListener> invocationListeners = null;

	/**
	 * Creates a new Endpoint for communication via Java Threads.
	 * 
	 * @param node1
	 *            The {@link Node}this endpoint invocates methods on.
	 * @param url1
	 *            The {@link URL}of this endpoint. The hostname of url is the
	 *            name of the node.
	 */
	public ThreadEndpoint(Node node1, URL url1) {
		super(node1, url1);
		this.logger = Logger.getLogger(ThreadEndpoint.class.getName() + "."
				+ node1.getNodeID());
		this.invocationListeners = new LinkedList<InvocationListener>();
		this.registry = Registry.getRegistryInstance();
		this.logger.info(this + " initialised.");
	}

	/**
	 * @return Implementation of {@link Node#notify(Node)}. See documentation
	 *         of {@link Node}.
	 */
	public ID getNodeID() {
		return this.node.getNodeID();
	}

	/**
	 * @param listener
	 */
	public void register(InvocationListener listener) {
		this.logger.debug("register(" + listener + ")");
		// synchronized (this.invocationListeners) {
		this.invocationListeners.add(listener);
		// }
		this.logger.debug("No. of invocation listeners "
				+ this.invocationListeners.size());
	}

	/**
	 * @param method
	 */
	private void notifyInvocationListeners(int method) {
		for (InvocationListener l : this.invocationListeners) {
			l.notifyInvocationOf(method);
		}
	}

	/**
	 * @param method
	 */
	private void notifyInvocationListenersFinished(int method) {
		for (InvocationListener l : this.invocationListeners) {
			l.notifyInvocationOfFinished(method);
		}
	}

	/**
	 * @param key
	 * @return The successor of <code>key</code>.
	 * @throws CommunicationException
	 */
	public Node findSuccessor(ID key) throws CommunicationException {
		this.checkIfCrashed();
		this.waitFor(Endpoint.LISTENING);
		/* delegate invocation to node. */
		this.notifyInvocationListeners(InvocationListener.FIND_SUCCESSOR);
		Node n = this.node.findSuccessor(key);
		if (n == this.node) {
			this.logger
					.debug("Returned node is local node. Converting to 'remote' reference. ");
			ThreadProxy t = new ThreadProxy(this.url, this.url);
			t.reSetNodeID(n.getNodeID());
			n = t;
		}
		this
				.notifyInvocationListenersFinished(InvocationListener.FIND_SUCCESSOR);
		return n;
	}

	/**
	 * @param entry
	 * @throws CommunicationException
	 */
	public void insertEntry(Entry entry) throws CommunicationException {
		this.checkIfCrashed();
		this.waitFor(Endpoint.ACCEPT_ENTRIES);
		/* delegate invocation to node. */
		this.notifyInvocationListeners(InvocationListener.INSERT_ENTRY);
		this.node.insertEntry(entry);
		this.notifyInvocationListenersFinished(InvocationListener.INSERT_ENTRY);
	}

	/**
	 * @param entry
	 * @throws CommunicationException
	 */
	public void removeEntry(Entry entry) throws CommunicationException {
		this.checkIfCrashed();
		this.waitFor(Endpoint.ACCEPT_ENTRIES);
		/* delegate invocation to node. */
		this.notifyInvocationListeners(InvocationListener.REMOVE_ENTRY);
		this.node.removeEntry(entry);
		this.notifyInvocationListenersFinished(InvocationListener.REMOVE_ENTRY);
	}

	/**
	 * @param potentialPredecessor
	 * @return Implementation of {@link Node#notify(Node)}. See documentation
	 *         of {@link Node}.
	 * @throws CommunicationException
	 */
	public List<Node> notify(Node potentialPredecessor)
			throws CommunicationException {
		this.checkIfCrashed();
		this.waitFor(Endpoint.LISTENING);
		this.notifyInvocationListeners(InvocationListener.NOTIFY);
		this.logger.debug("Invoking notify on local node " + this.node);
		List<Node> n = this.node.notify(potentialPredecessor);
		this.logger.debug("Notify resulted in " + n);

		for (Node current : n) {
			if (current == this.node) {
				n.remove(current);

				this.logger
						.debug("Returned node is local node. Converting to 'remote' reference. ");
				n.add(new ThreadProxy(this.url, this.url));
			}
		}
		this.notifyInvocationListenersFinished(InvocationListener.NOTIFY);
		return n;
	}

	/**
	 * @throws CommunicationException
	 */
	public void ping() throws CommunicationException {
		this.checkIfCrashed();
		this.waitFor(Endpoint.LISTENING);
		this.notifyInvocationListeners(InvocationListener.PING);
		this.node.ping();
		this.notifyInvocationListenersFinished(InvocationListener.PING);
	}

	/**
	 * @param id
	 * @return The retrieved entries.
	 * @throws CommunicationException
	 */
	public Set<Entry> retrieveEntries(ID id) throws CommunicationException {
		this.checkIfCrashed();
		this.waitFor(Endpoint.ACCEPT_ENTRIES);
		this.notifyInvocationListeners(InvocationListener.RETRIEVE_ENTRIES);
		Set<Entry> s = this.node.retrieveEntries(id);
		this
				.notifyInvocationListenersFinished(InvocationListener.RETRIEVE_ENTRIES);
		return s;
	}

	/**
	 * @param predecessor
	 * @throws CommunicationException
	 */
	public void leavesNetwork(Node predecessor) throws CommunicationException {
		this.checkIfCrashed();
		this.notifyInvocationListeners(InvocationListener.LEAVES_NETWORK);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美性猛交xxxx黑人交 | 中文字幕第一页久久| 日韩精品一二三四| 欧美精品丝袜久久久中文字幕| 亚洲午夜免费福利视频| 欧美在线|欧美| 亚洲成人av电影| 欧美军同video69gay| 美脚の诱脚舐め脚责91| 精品剧情v国产在线观看在线| 国产一区中文字幕| 国产精品美女久久久久久久网站| 99精品黄色片免费大全| 亚洲欧美日韩国产成人精品影院 | 欧美三级日本三级少妇99| 亚洲国产成人av网| 日韩亚洲欧美综合| 国产在线精品一区二区夜色 | 亚洲色图丝袜美腿| 欧美日韩高清在线| 开心九九激情九九欧美日韩精美视频电影 | 懂色av一区二区在线播放| 亚洲精品水蜜桃| 欧美视频精品在线观看| 美女国产一区二区三区| 国产精品白丝在线| 欧美狂野另类xxxxoooo| 丰满放荡岳乱妇91ww| 一片黄亚洲嫩模| 精品国产一区二区三区四区四| 成人性视频网站| 视频在线观看一区二区三区| 久久色.com| 欧美午夜不卡在线观看免费| 久久99精品久久只有精品| 1区2区3区国产精品| 制服丝袜在线91| 成人黄色av网站在线| 日韩电影一区二区三区| 中文字幕制服丝袜成人av| 欧美人牲a欧美精品| 成人aa视频在线观看| 老司机免费视频一区二区| 亚洲美女免费视频| 久久精品视频免费| 制服丝袜av成人在线看| 99精品欧美一区二区蜜桃免费| 毛片基地黄久久久久久天堂| 亚洲欧洲综合另类在线| 久久久精品人体av艺术| 欧美日韩一区二区三区在线看 | 99久久er热在这里只有精品15| 日本成人在线看| 亚洲欧美日韩成人高清在线一区| 亚洲精品一区二区三区蜜桃下载| 日本韩国精品一区二区在线观看| 国产成人精品一区二| 久久国产尿小便嘘嘘尿| 亚洲亚洲精品在线观看| 亚洲欧美自拍偷拍色图| 久久久影院官网| 精品久久免费看| 欧美日韩精品福利| 色婷婷av一区二区三区软件| 成人手机在线视频| 国产一区二区在线视频| 奇米影视在线99精品| 一区二区成人在线| 亚洲人成电影网站色mp4| 国产精品传媒视频| 国产精品成人午夜| 国产精品免费aⅴ片在线观看| 国产三区在线成人av| 久久婷婷国产综合精品青草 | 欧美性猛交xxxx黑人交| 91视频www| 91同城在线观看| 色综合天天综合网天天狠天天| 成人的网站免费观看| 成人av在线影院| 国产99久久久精品| 欧洲av一区二区嗯嗯嗯啊| av网站免费线看精品| www.欧美色图| 色婷婷国产精品综合在线观看| 色女孩综合影院| 欧美系列亚洲系列| 欧美日韩一区国产| 欧美一区二区二区| 日韩精品中文字幕在线不卡尤物| 日韩一区二区在线观看| 日韩欧美激情一区| 久久蜜臀中文字幕| 亚洲欧洲日产国码二区| 一区二区三区小说| 亚洲高清免费一级二级三级| 日日欢夜夜爽一区| 韩国视频一区二区| 成人h动漫精品| 欧美亚州韩日在线看免费版国语版| 欧美精品久久一区| 日韩精品一区二区三区三区免费 | www一区二区| 国产精品伦理在线| 樱花影视一区二区| 日韩—二三区免费观看av| 国内成人精品2018免费看| 成人激情视频网站| 欧美日韩在线播放三区四区| 欧美mv日韩mv国产网站app| 国产精品人妖ts系列视频| 一区二区三区四区不卡视频| 日韩精彩视频在线观看| 国产精品综合一区二区| 色香蕉成人二区免费| 日韩女优视频免费观看| 国产精品盗摄一区二区三区| 日本成人在线不卡视频| 成人av在线网| 91精品国产乱码| 国产精品国产三级国产aⅴ原创 | 欧美视频中文字幕| 亚洲精品在线三区| 一区二区三区不卡在线观看 | 亚洲欧洲一区二区三区| 视频一区二区中文字幕| 成人午夜免费av| 欧美丰满嫩嫩电影| 综合久久久久综合| 狠狠色丁香婷婷综合| 91美女在线观看| 久久久久久久久伊人| 偷偷要91色婷婷| 99九九99九九九视频精品| 精品第一国产综合精品aⅴ| 亚洲免费在线观看| 国产一区二区主播在线| 欧美喷潮久久久xxxxx| 1024国产精品| 国产传媒一区在线| 精品福利二区三区| 日韩激情视频网站| 欧美亚洲动漫制服丝袜| 丝袜亚洲另类丝袜在线| 99久久久无码国产精品| 久久伊人中文字幕| 日本欧美肥老太交大片| 欧美日韩五月天| 中文字幕在线一区二区三区| 国产一区二区三区免费在线观看| 欧美一区二区三区色| 亚洲成人免费视| 一本色道综合亚洲| 国产精品成人一区二区三区夜夜夜| 久久精品国产久精国产| 欧美区视频在线观看| 亚洲超碰精品一区二区| 日本久久电影网| 尤物在线观看一区| 一本色道久久综合亚洲91 | 亚洲色图欧洲色图婷婷| 国产成人av电影在线| 欧美精品一区二区高清在线观看 | 九色porny丨国产精品| 欧美精品一二三| 亚洲成a人v欧美综合天堂下载| 91国偷自产一区二区三区观看| 国产精品久久一卡二卡| 成人午夜短视频| 国产三级精品三级| 高清在线成人网| 国产精品入口麻豆原神| 99re亚洲国产精品| 亚洲欧美日韩在线播放| 色视频成人在线观看免| 亚洲国产视频一区| 欧美情侣在线播放| 热久久久久久久| 精品三级av在线| 国产乱码字幕精品高清av| 国产精品妹子av| 日本高清不卡视频| 日韩电影在线一区二区三区| 欧美www视频| 成人小视频在线观看| 亚洲女子a中天字幕| 欧美午夜精品久久久久久超碰 | 国精产品一区一区三区mba桃花| 欧美变态tickle挠乳网站| 狠狠色综合日日| 国产精品久久777777| 色婷婷综合久久久中文一区二区 | 欧美成人在线直播| 不卡一区在线观看| 亚洲国产精品视频| 精品国产三级a在线观看| 国产99久久久国产精品| 亚洲影视在线观看| 欧美一卡二卡在线| 成人亚洲一区二区一|