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

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

?? chordimpl.java

?? Chord package into p2psim
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
/***************************************************************************
 *                                                                         *
 *                             ChordFuture.java                            *
 *                            -------------------                          *
 *   date                 : 16.08.2005                                     *
 *   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.service.impl;

import static de.uniba.wiai.lspi.util.logging.Logger.LogLevel.DEBUG;
import static de.uniba.wiai.lspi.util.logging.Logger.LogLevel.INFO;

import java.io.Serializable;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

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.chord.service.AsynChord;
import de.uniba.wiai.lspi.chord.service.Chord;
import de.uniba.wiai.lspi.chord.service.ChordCallback;
import de.uniba.wiai.lspi.chord.service.ChordFuture;
import de.uniba.wiai.lspi.chord.service.ChordRetrievalFuture;
import de.uniba.wiai.lspi.chord.service.Key;
import de.uniba.wiai.lspi.chord.service.Report;
import de.uniba.wiai.lspi.chord.service.ServiceException;
import de.uniba.wiai.lspi.util.logging.Logger;

/**
 * Implements all operations which can be invoked on the local node.
 * 
 * @author Karsten Loesing
 * @version 1.0.5
 */
public final class ChordImpl implements Chord, Report, AsynChord {

	/**
	 * Number of threads to allow concurrent invocations of asynchronous
	 * methods. e.g. {@link ChordImpl#insertAsync(Key, Serializable)}.
	 */
	private static final int ASYNC_CALL_THREADS = Integer.parseInt(System
			.getProperty(ChordImpl.class.getName() + ".AsyncThread.no"));

	/**
	 * Time in seconds until the stabilize task is started for the first time.
	 */
	private static final int STABILIZE_TASK_START = Integer
			.parseInt(System
					.getProperty("de.uniba.wiai.lspi.chord.service.impl.ChordImpl.StabilizeTask.start"));

	/**
	 * Time in seconds between two invocations of the stabilize task.
	 */
	private static final int STABILIZE_TASK_INTERVAL = Integer
			.parseInt(System
					.getProperty("de.uniba.wiai.lspi.chord.service.impl.ChordImpl.StabilizeTask.interval"));

	/**
	 * Time in seconds until the fix finger task is started for the first time.
	 */
	private static final int FIX_FINGER_TASK_START = Integer
			.parseInt(System
					.getProperty("de.uniba.wiai.lspi.chord.service.impl.ChordImpl.FixFingerTask.start"));

	/**
	 * Time in seconds between two invocations of the fix finger task.
	 */
	private static final int FIX_FINGER_TASK_INTERVAL = Integer
			.parseInt(System
					.getProperty("de.uniba.wiai.lspi.chord.service.impl.ChordImpl.FixFingerTask.interval"));

	/**
	 * Time in seconds until the check predecessor task is started for the first
	 * time.
	 */
	private static final int CHECK_PREDECESSOR_TASK_START = Integer
			.parseInt(System
					.getProperty("de.uniba.wiai.lspi.chord.service.impl.ChordImpl.CheckPredecessorTask.start"));

	/**
	 * Time in seconds between two invocations of the check predecessor task.
	 */
	private static final int CHECK_PREDECESSOR_TASK_INTERVAL = Integer
			.parseInt(System
					.getProperty("de.uniba.wiai.lspi.chord.service.impl.ChordImpl.CheckPredecessorTask.interval"));

	/**
	 * Number of references in the successor list.
	 */
	private static final int NUMBER_OF_SUCCESSORS = (Integer
			.parseInt(System
					.getProperty("de.uniba.wiai.lspi.chord.service.impl.ChordImpl.successors")) < 1) ? 1
			: Integer
					.parseInt(System
							.getProperty("de.uniba.wiai.lspi.chord.service.impl.ChordImpl.successors"));

	/**
	 * Object logger.
	 */
	protected Logger logger;

	/**
	 * Reference on that part of the node implementation which is accessible by
	 * other nodes; if <code>null</code>, this node is not connected
	 */
	private NodeImpl localNode;

	/**
	 * Entries stored at this node, including replicas.
	 */
	private Entries entries;

	/**
	 * Executor service for local maintenance tasks.
	 */
	private ScheduledExecutorService maintenanceTasks;

	/**
	 * Executor service for asynch requests.
	 */
	private ExecutorService asyncExecutor;

	/**
	 * ThreadFactory used with Executor services.
	 * 
	 * @author sven
	 * 
	 */
	private static class ChordThreadFactory implements
			java.util.concurrent.ThreadFactory {

		private String executorName;

		ChordThreadFactory(String executorName) {
			this.executorName = executorName;
		}

		public Thread newThread(Runnable r) {
			Thread newThread = new Thread(r);
			newThread.setName(this.executorName + "-" + newThread.getName());
			return newThread;
		}

	}

	/**
	 * References to remote nodes.
	 */
	protected References references;

	/**
	 * Reference on hash function (singleton instance).
	 */
	private HashFunction hashFunction;

	/**
	 * This node's URL.
	 */
	private URL localURL;

	/**
	 * This node's ID.
	 */
	private ID localID;

	/* constructor */

	/**
	 * Creates a new instance of ChordImpl which initially is disconnected.
	 * Constructor is hidden. Only constructor.
	 */
	public ChordImpl() {
		this.logger = Logger.getLogger(ChordImpl.class.getName()
				+ ".unidentified");
		this.logger.debug("Logger initialized.");

		this.maintenanceTasks = new ScheduledThreadPoolExecutor(3,
				new ChordThreadFactory("MaintenanceTaskExecution"));
		this.asyncExecutor = Executors.newFixedThreadPool(
				ChordImpl.ASYNC_CALL_THREADS, new ChordThreadFactory(
						"AsynchronousExecution"));
		this.hashFunction = HashFunction.getHashFunction();
		logger.info("ChordImpl initialized!");
	}

	/**
	 * @return The Executor executing asynchronous request.
	 */
	final Executor getAsyncExecutor() {
		if (this.asyncExecutor == null) {
			throw new NullPointerException("ChordImpl.asyncExecutor is null!");
		}
		return this.asyncExecutor;
	}

	/* implementation of Chord interface */

	public final URL getURL() {
		return this.localURL;
	}

	public final void setURL(URL nodeURL) {

		if (nodeURL == null) {
			NullPointerException e = new NullPointerException(
					"Cannot set URL to null!");
			this.logger.error("Null pointer", e);
			throw e;
		}

		if (this.localNode != null) {
			IllegalStateException e = new IllegalStateException(
					"URL cannot be set after creating or joining a network!");
			this.logger.error("Illegal state.", e);
			throw e;
		}

		this.localURL = nodeURL;

		this.logger.info("URL was set to " + nodeURL);
	}

	public final ID getID() {
		return this.localID;
	}

	public final void setID(ID nodeID) {

		if (nodeID == null) {
			NullPointerException e = new NullPointerException(
					"Cannot set ID to null!");
			this.logger.error("Null pointer", e);
			throw e;
		}

		if (this.localNode != null) {
			IllegalStateException e = new IllegalStateException(
					"ID cannot be set after creating or joining a network!");
			this.logger.error("Illegal state.", e);
			throw e;
		}

		this.localID = nodeID;
		this.logger = Logger.getLogger(ChordImpl.class.getName() + "."
				+ this.localID);
	}

	public final void create() throws ServiceException {

		// is node already connected?
		if (this.localNode != null) {
			throw new ServiceException(
					"Cannot create network; node is already connected!");
		}

		// has nodeURL been set?
		if (this.localURL == null) {
			throw new ServiceException("Node URL is not set yet!");
		}

		// if necessary, generate nodeID out of nodeURL
		if (this.getID() == null) {
			this.setID(this.hashFunction.createUniqueNodeID(this.localURL));
		}

		// establish connection
		this.createHelp();

	}

	public final void create(URL localURL1) throws ServiceException {

		// check if parameters are valid
		if (localURL1 == null) {
			throw new NullPointerException(
					"At least one parameter is null which is not permitted!");
		}

		// is node already connected?
		if (this.localNode != null) {
			throw new ServiceException(
					"Cannot create network; node is already connected!");
		}

		// set nodeURL
		this.localURL = localURL1;

		// if necessary, generate nodeID out of nodeURL
		if (this.getID() == null) {
			this.setID(this.hashFunction.createUniqueNodeID(this.localURL));
		}

		// establish connection
		this.createHelp();

	}

	public final void create(URL localURL1, ID localID1)
			throws ServiceException {

		// check if parameters are valid
		if (localURL1 == null || localID1 == null) {
			throw new IllegalArgumentException(
					"At least one parameter is null which is not permitted!");
		}

		// is node already connected?
		if (this.localNode != null) {
			throw new ServiceException(
					"Cannot create network; node is already connected!");
		}

		// set nodeURL
		this.localURL = localURL1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一区二区三区高清| 91捆绑美女网站| 亚洲特级片在线| 91精品在线一区二区| 高清成人在线观看| 日韩黄色免费电影| 亚洲品质自拍视频| 久久久国产精品麻豆| 欧美日韩精品是欧美日韩精品| 丰满放荡岳乱妇91ww| 日韩av一区二区在线影视| 最新日韩av在线| 国产午夜精品福利| 日韩午夜激情电影| 欧美人体做爰大胆视频| 91麻豆免费观看| 国产成人精品免费| 韩国女主播成人在线| 日韩电影在线一区| 亚洲一区二区影院| 亚洲人成影院在线观看| 欧美国产一区二区| 欧美精品一区二区久久久| 制服.丝袜.亚洲.中文.综合 | 91天堂素人约啪| 国产综合久久久久久久久久久久| 亚洲成av人片一区二区梦乃| 亚洲欧美一区二区久久| 中文字幕欧美激情| 久久久久久久综合狠狠综合| 日韩欧美国产一区在线观看| 91精品国产综合久久精品麻豆 | 精品粉嫩aⅴ一区二区三区四区| 欧美日韩一级二级| 欧美亚洲一区三区| 91视频www| 色婷婷综合久久久久中文| www.亚洲激情.com| 成人av免费观看| 成人精品一区二区三区四区| 懂色av一区二区三区蜜臀| 国产精品1区二区.| 国产.欧美.日韩| 不卡的av中国片| av电影一区二区| 99精品视频在线观看| 99精品国产一区二区三区不卡| 成人综合日日夜夜| 色综合夜色一区| 在线精品视频小说1| 欧美三级资源在线| 欧美精品乱码久久久久久| 91精品福利在线一区二区三区| 欧美一级xxx| 久久久久久一级片| 国产精品不卡在线| 亚洲精品一二三四区| 香蕉成人伊视频在线观看| 日韩国产在线一| 裸体歌舞表演一区二区| 国产精品夜夜嗨| 99精品欧美一区二区三区小说| 91麻豆免费视频| 91精品国产色综合久久久蜜香臀| 日韩一区二区精品葵司在线| 久久精品在线免费观看| 日韩一区中文字幕| 亚洲妇熟xx妇色黄| 久久99热国产| 99久久久久免费精品国产| 欧美色男人天堂| 欧美精品一区二区三区蜜桃| 国产精品不卡在线| 爽爽淫人综合网网站| 国产麻豆成人精品| 91美女片黄在线| 日韩一级二级三级| 国产精品麻豆一区二区| 亚洲电影一级黄| 国产乱码精品一区二区三区忘忧草 | 欧美色精品天天在线观看视频| 日韩无一区二区| 国产精品系列在线| 亚洲成av人影院| 国产成a人亚洲精品| 欧美天天综合网| 国产人伦精品一区二区| 亚洲激情校园春色| 韩国女主播成人在线| 在线视频国内自拍亚洲视频| 精品处破学生在线二十三| 综合av第一页| 精品午夜久久福利影院| 一本到一区二区三区| 日韩视频在线观看一区二区| 日韩毛片高清在线播放| 久久精品国产亚洲高清剧情介绍| 91美女蜜桃在线| 国产性色一区二区| 天天操天天色综合| 91日韩一区二区三区| 26uuu国产日韩综合| 亚洲电影一级片| 91在线观看地址| 国产香蕉久久精品综合网| 日韩精品一二三| 日本韩国欧美在线| 国产精品午夜免费| 国产精品亚洲专一区二区三区| 欧美精三区欧美精三区| 亚洲视频一区二区在线| 国产一区二区三区日韩| 欧美一级片在线| 亚洲国产美女搞黄色| 99久久综合精品| 国产偷国产偷精品高清尤物 | 99精品视频在线观看| 国产日韩精品视频一区| 麻豆精品新av中文字幕| 欧美日韩一区二区三区不卡| 一区二区三区小说| av不卡一区二区三区| 国产亚洲婷婷免费| 国产一区在线不卡| 精品国产自在久精品国产| 日本亚洲电影天堂| 91精品国产色综合久久ai换脸| 亚洲一区二区精品久久av| aaa亚洲精品一二三区| 中文字幕免费观看一区| 国产精品18久久久久久久久| 欧美videofree性高清杂交| 日本伊人午夜精品| 7777精品久久久大香线蕉| 一区二区三区在线观看国产| 色偷偷一区二区三区| 亚洲欧美乱综合| 欧美在线免费观看视频| 亚洲尤物在线视频观看| 欧美另类变人与禽xxxxx| 亚洲综合一区在线| 欧美日韩在线免费视频| 天天综合网 天天综合色| 欧美裸体bbwbbwbbw| 日韩高清在线观看| 日韩精品中文字幕一区| 激情文学综合插| 久久久久久久综合色一本| 成人永久aaa| 亚洲欧美韩国综合色| 欧美写真视频网站| 视频一区在线视频| 日韩精品一区二区三区视频 | 日韩一区二区麻豆国产| 韩国精品主播一区二区在线观看 | 欧美一区二区三区免费大片| 美女性感视频久久| 久久久国产精华| 97久久超碰精品国产| 亚洲欧美乱综合| 91精品国产高清一区二区三区蜜臀| 琪琪久久久久日韩精品| 久久亚洲捆绑美女| 99国产精品国产精品毛片| 一区二区三区国产豹纹内裤在线| 色狠狠桃花综合| 免费一级片91| 欧美国产精品中文字幕| 色哟哟在线观看一区二区三区| 日本亚洲一区二区| 国产亚洲精品bt天堂精选| 色呦呦国产精品| 美日韩黄色大片| 中文字幕在线视频一区| 欧美日韩夫妻久久| 国产精品亚洲第一| 亚洲综合男人的天堂| 日韩精品在线一区| 色综合天天综合在线视频| 丝袜亚洲另类欧美| 中文字幕精品综合| 在线播放国产精品二区一二区四区| 老司机精品视频一区二区三区| 国产目拍亚洲精品99久久精品| 欧美亚洲动漫另类| 国产精品一区2区| 五月天欧美精品| 国产欧美日韩视频在线观看| 欧美艳星brazzers| 国产高清无密码一区二区三区| 亚洲综合另类小说| 国产日韩一级二级三级| 欧美日韩在线播| 北条麻妃一区二区三区| 免费观看一级欧美片| 亚洲精品第1页| 国产女主播一区| 日韩美一区二区三区| 精品视频一区二区三区免费| 丁香天五香天堂综合|