亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲视频在线一区| 综合激情成人伊人| 国产精品久久久久永久免费观看| 亚洲少妇最新在线视频| 国产精品资源网站| 天堂在线一区二区| 99精品久久只有精品| 欧美日韩久久一区| 国产欧美一区二区精品秋霞影院| 日韩和欧美的一区| 91浏览器打开| 国产精品视频一二三区| 久久99国产精品久久| 欧美精品v国产精品v日韩精品| 亚洲欧美中日韩| 美女免费视频一区| 91麻豆精品91久久久久同性| 一区二区在线观看免费| 色综合久久久久综合99| 欧美国产一区二区在线观看 | 欧洲精品一区二区| 亚洲欧美日韩系列| 99免费精品视频| 国产精品午夜免费| 欧美一区二区三区性视频| 亚洲美女视频在线观看| 色一区在线观看| 国产精品成人在线观看| 成人av资源站| 亚洲美女在线一区| 色偷偷88欧美精品久久久| 亚洲六月丁香色婷婷综合久久| 成人app软件下载大全免费| 中文字幕制服丝袜一区二区三区| 国产91精品精华液一区二区三区| 中文字幕免费不卡| 99久久婷婷国产综合精品电影| 国产精品久久毛片a| 91影院在线观看| 亚洲在线视频网站| 91精品国产一区二区| 激情综合五月天| 中文字幕欧美激情一区| 一本色道综合亚洲| 午夜不卡在线视频| 精品国产第一区二区三区观看体验| 国产在线国偷精品产拍免费yy| 国产亚洲精品免费| 色乱码一区二区三区88| 亚洲福利一二三区| 精品不卡在线视频| 成人网在线播放| 一区二区久久久| 欧美电影免费观看完整版| 大陆成人av片| 亚洲高清久久久| 久久综合九色综合97婷婷女人| 丁香另类激情小说| 亚洲va欧美va人人爽午夜| 欧美成人一级视频| 99久久精品免费| 日日夜夜精品视频免费| 国产欧美综合色| 欧美三级日韩三级| 国产一区二区剧情av在线| 一区二区三区不卡在线观看| 日韩一级二级三级精品视频| 不卡的av在线| 蜜臀av性久久久久av蜜臀妖精| 国产视频视频一区| 在线不卡a资源高清| zzijzzij亚洲日本少妇熟睡| 日本欧美一区二区三区| 国产精品成人午夜| 日韩视频国产视频| 91在线观看下载| 久久99在线观看| 亚洲小说春色综合另类电影| 久久精品视频一区二区三区| 欧美男人的天堂一二区| 99热精品国产| 国产综合久久久久久鬼色| 久久久久高清精品| 国模少妇一区二区三区| 中文天堂在线一区| 91精品国产麻豆国产自产在线 | 国产成人午夜视频| 香蕉成人啪国产精品视频综合网| 国产亚洲女人久久久久毛片| 在线播放一区二区三区| 色综合网色综合| 国产高清久久久久| 欧美日韩精品福利| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 波多野结衣中文字幕一区二区三区 | 7777精品久久久大香线蕉| www.激情成人| 成人一区在线观看| 国产精品亚洲第一区在线暖暖韩国| 天涯成人国产亚洲精品一区av| 亚洲欧美日韩在线| 中文字幕在线观看一区| 久久精品亚洲乱码伦伦中文| 日韩免费成人网| 337p亚洲精品色噜噜噜| 欧美日韩国产另类不卡| 91国偷自产一区二区开放时间| 99久久婷婷国产综合精品| 不卡一区二区在线| 成人国产在线观看| 成人免费看视频| 国产成+人+日韩+欧美+亚洲| 国产一区二区电影| 国产伦精一区二区三区| 国产伦精一区二区三区| 激情综合网激情| 国产成人激情av| 国产成人av一区二区三区在线观看| 国内外成人在线视频| 国产一区在线不卡| 成人av电影在线网| 91视频91自| 欧美老年两性高潮| 日韩精品一区二| 中文字幕的久久| 亚洲欧美一区二区三区极速播放 | 欧美精品一二三| 欧美一区二区视频在线观看2020| 欧美肥胖老妇做爰| 日韩欧美二区三区| 中文字幕欧美三区| 亚洲一级在线观看| 另类小说视频一区二区| 豆国产96在线|亚洲| 91福利社在线观看| 日韩三级免费观看| 日本一区二区三区dvd视频在线| 日韩一区欧美小说| 日韩1区2区3区| 国产成人午夜高潮毛片| 在线中文字幕不卡| 久久综合99re88久久爱| 亚洲色欲色欲www| 青青草伊人久久| bt7086福利一区国产| 欧美精品在线视频| 亚洲国产成人在线| 日日夜夜免费精品| 成人app网站| 日韩精品综合一本久道在线视频| 中文久久乱码一区二区| 丝袜国产日韩另类美女| 国v精品久久久网| 777奇米成人网| 亚洲日本丝袜连裤袜办公室| 蜜臀av性久久久久蜜臀aⅴ流畅 | 26uuu精品一区二区| 亚洲视频精选在线| 国产自产高清不卡| 欧美性生活一区| 国产欧美精品日韩区二区麻豆天美| 一区二区三区四区av| 国产麻豆视频一区| 69精品人人人人| 最新不卡av在线| 国产馆精品极品| 欧美丰满一区二区免费视频| 亚洲欧美在线视频| 国产精品一区二区在线看| 欧美日韩美少妇| 亚洲视频一区二区免费在线观看| 精品一区二区三区不卡| 欧美撒尿777hd撒尿| 国产视频在线观看一区二区三区 | 午夜婷婷国产麻豆精品| 福利一区二区在线| 精品久久久久久无| 日韩av不卡在线观看| 欧美亚洲国产怡红院影院| 国产精品人人做人人爽人人添| 六月丁香综合在线视频| 在线电影院国产精品| 一区二区三区.www| 99免费精品在线观看| 国产日韩欧美高清| 精品一区二区三区免费观看| 正在播放亚洲一区| 丝袜美腿亚洲综合| 911国产精品| 日日噜噜夜夜狠狠视频欧美人| 欧美性猛交xxxx黑人交| 最新中文字幕一区二区三区| 国产成人av电影在线播放| 欧美精品一区二区三区蜜臀| 精品中文字幕一区二区| 日韩美女一区二区三区| 久久国产尿小便嘘嘘尿| 精品理论电影在线观看| 激情六月婷婷综合| 亚洲午夜精品久久久久久久久|