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

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

?? references.java

?? Chord package into p2psim
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
					+ newReference.getNodeID().toString()
					+ " to finger table and successor list. Whether it fit "
					+ "or not depends on those data structures.");
		}
	}

	/**
	 * Removes the given node reference from the finger table and the successor
	 * list. If the given reference is the current predecessor, the predecessor
	 * reference will be <code>null</code> afterwards.
	 * 
	 * @param oldReference
	 *            Reference to remove from ALL data structures.
	 * @throws NullPointerException
	 *             If reference to remove is <code>null</code>.
	 */
	final synchronized void removeReference(Node oldReference) {

		if (oldReference == null) {
			NullPointerException e = new NullPointerException(
					"Reference to remove must not be null!");
			this.logger.error("Null pointer", e);
			throw e;
		}

		this.fingerTable.removeReference(oldReference);
		this.successorList.removeReference(oldReference);

		if (oldReference.equals(this.getPredecessor())) {
			this.predecessor = null;
		}

		disconnectIfUnreferenced(oldReference);

		if (this.logger.isEnabledFor(DEBUG)) {
			this.logger
					.debug("Attempted to remove reference "
							+ oldReference
							+ " from all data structures including predecessor reference.");
		}
	}

	/**
	 * Closes the connection to the given reference, if it is not kept in any
	 * data structure (ie. finger table, successor list, predecessor) any more.
	 * 
	 * @param removedReference
	 *            Node to which the connection shall be closed, if there exists
	 *            no reference any more.
	 * @throws NullPointerException
	 *             If given reference is null.
	 */
	void disconnectIfUnreferenced(Node removedReference) {
		if (removedReference == null) {
			NullPointerException e = new NullPointerException(
					"Reference may not be null!");
			this.logger.error("Null pointer", e);
			throw e;
		}

		if (!this.containsReference(removedReference)) {
			if (!(removedReference instanceof Proxy)) {
				this.logger
						.error("Attempt to disconnect unused reference failed");
				throw new RuntimeException("Reference should be of type Proxy");
			}
			this.logger.debug("Disconnecting unused reference on node "
					+ removedReference);
			removedReference.disconnect();
		}
	}

	/**
	 * Determines this node's direct successor and returns it. If no successor
	 * is known, <code>null</code> is returned.
	 * 
	 * @return The local node's direct successor, or <code>null</code> if no
	 *         successor is known.
	 */
	final synchronized Node getSuccessor() {
		// direct successor is the first entry in my successor list
		return this.successorList.getDirectSuccessor();
	}

	/**
	 * Returns a formatted string of the IDs of all references stored on this
	 * node. This includes references in the finger table and successor list as
	 * well as the predecessor.
	 * 
	 * @return Formatted string of references.
	 */
	public synchronized String toString() {
		StringBuilder result = new StringBuilder("Node: "
				+ this.localID.toString() + ", " + this.localURL + "\n");
		result.append(this.fingerTable.toString());

		result.append(this.successorList.toString());
		result.append("Predecessor: "
				+ (this.predecessor == null ? "null" : ""
						+ this.predecessor.getNodeID() + ", "
						+ this.predecessor.getNodeURL()));
		return result.toString();
	}

	/**
	 * Returns the reference on this node's predecessor, if available. If no
	 * predecessor exists for this node, <code>null</code> is returned.
	 * 
	 * @return Reference on this node's predecessor, if available. If no
	 *         predecessor exists for this node, <code>null</code> is
	 *         returned.
	 */
	final synchronized Node getPredecessor() {
		return this.predecessor;
	}

	/**
	 * Sets the given reference as this node's predecessor. If the former value
	 * of this predecessor's node was <code>null</code> and if this reference
	 * is not used any more (eg. in finger table or successor list), the
	 * connection to it is closed.
	 * 
	 * @param potentialPredecessor
	 *            Reference on the node to be set as new predecessor; may not be
	 *            null
	 * @throws NullPointerException
	 *             If potential predecessor is null.
	 */
	final synchronized void setPredecessor(Node potentialPredecessor) {

		if (potentialPredecessor == null) {
			NullPointerException e = new NullPointerException(
					"Potential predecessor of method setPredecessor may not be "
							+ "null!");
			this.logger.error("Null pointer", e);
			throw e;
		}
		this.checkIfProxy(potentialPredecessor);

		boolean info = this.logger.isEnabledFor(INFO);
		if (!(potentialPredecessor.equals(this.predecessor))) {
			Node formerPredecessor = this.predecessor;
			this.predecessor = potentialPredecessor;
			if (formerPredecessor != null) {
				this.disconnectIfUnreferenced(formerPredecessor);
				/*
				 * The replicas, which are in the range between the old and the
				 * new predecessor, on the last successor of this node have to
				 * be removed if the successor list is full. => capacity of sl ==
				 * length of sl.
				 */
				int sLSize = this.successorList.getSize();
				if (this.successorList.getCapacity() == sLSize) {
					Node lastSuccessor = this.successorList.getReferences()
							.get(sLSize - 1);
					try {
						lastSuccessor.removeReplicas(this.predecessor
								.getNodeID(), new HashSet<Entry>());
					} catch (CommunicationException e) {
						logger
								.warn(
										"Could not remove replicas on last predecessor",
										e);
					}
				}
				if (this.logger.isEnabledFor(DEBUG)) {
					this.logger.debug("Old predecessor " + formerPredecessor
							+ " was replaced by " + potentialPredecessor);
				}
			} else {
				if (info) {
					this.logger.info("Predecessor reference set to "
							+ potentialPredecessor + "; was null before.");
				}
				Set<Entry> entriesToRep = this.entries.getEntriesInInterval(
						this.predecessor.getNodeID(), this.localID);
				List<Node> successors = this.successorList.getReferences();
				for (Node successor : successors) {
					try {
						successor.insertReplicas(entriesToRep);
					} catch (CommunicationException e) {
						this.logger.warn(
								"Damn. Could not replicate to successor "
										+ successor.getNodeID(), e);
					}
				}
			}
		}
	}

	/**
	 * Returns an unmodifiable list of this node's successors.
	 * 
	 * @return Unmodifiable successor list.
	 */
	final synchronized List<Node> getSuccessors() {
		return this.successorList.getReferences();
	}

	/**
	 * Determines if the given reference is contained in any one data structure,
	 * ie. finger table, successor list, or predecessor reference.
	 * 
	 * @param newReference
	 *            Reference to look up.
	 * @throws NullPointerException
	 *             If given reference is <code>null</code>.
	 * @return <code>true</code> if the reference is contained and
	 *         <code>false</code> if not.
	 */
	final synchronized boolean containsReference(Node newReference) {
		if (newReference == null) {
			NullPointerException e = new NullPointerException(
					"Reference to look up must not be null!");
			this.logger.error("Null pointer", e);
			throw e;
		}
		return (this.fingerTable.containsReference(newReference)
				|| this.successorList.containsReference(newReference) || newReference
				.equals(this.predecessor));
	}

	/**
	 * Returns a formatted string of this node's finger table.
	 * 
	 * @return String representation of finger table.
	 */
	final String printFingerTable() {
		return this.fingerTable.toString();
	}

	/**
	 * Returns a formatted string of this node's successor list.
	 * 
	 * @return String representation of successor list.
	 */
	final String printSuccessorList() {
		return this.successorList.toString();
	}

	/**
	 * Adds the given node reference to the finger table and successor list AND
	 * sets it as new predecessor reference, if appropriate. Appropriateness is
	 * given if either the former predecessor reference was <code>null</code>
	 * or the new reference's ID is located between the old predecessor ID and
	 * this node's ID. Even if not appropriate as predecessor, the reference is
	 * added to finger table and successor list.
	 * 
	 * @param potentialPredecessor
	 *            Reference which should be this node's predecessor.
	 * @throws NullPointerException
	 *             If the given reference is <code>null</code>.
	 */
	void addReferenceAsPredecessor(Node potentialPredecessor) {

		this.checkIfProxy(potentialPredecessor);
		if (potentialPredecessor == null) {
			NullPointerException e = new NullPointerException(
					"Reference to potential predecessor may not be null!");
			this.logger.error("Null pointer", e);
			throw e;
		}

		// if the local node did not have a predecessor reference before
		// or if the potential predecessor is closer to this local node,
		// replace the predecessor reference
		if (this.predecessor == null
				|| potentialPredecessor.getNodeID().isInInterval(
						this.predecessor.getNodeID(), this.localID)) {

			if (this.logger.isEnabledFor(INFO)) {
				this.logger
						.info("Setting a new predecessor reference: New reference is "
								+ potentialPredecessor
								+ ", old reference was "
								+ (this.predecessor == null ? "null"
										: this.predecessor));
			}

			// replace predecessor reference
			this.setPredecessor(potentialPredecessor);

			/*
			 * If a new predecessor, better than the old one has arrived, we
			 * have to copy the entries, that are relevant for this new
			 * predecessor. This has to be done by the predecessor itself, NOT
			 * here. 18.06.2007. sven
			 */
			// final Set<Entry> entries = this.entries.getEntriesInInterval(
			// this.predecessor.nodeID, this.localID);
			// this.localChord.getAsyncExecutor().execute(new Runnable() {
			// public void run() {
			// try {
			// for (Entry entryToInsert : entries) {
			// getPredecessor().insertEntry(entryToInsert);
			// }
			// } catch (CommunicationException e) {
			// }
			// }
			// });
		}

		// add reference
		this.addReference(potentialPredecessor);

	}

	/**
	 * Determines the first i entries in the finger table.
	 * 
	 * @param i
	 * @return The first (i+1) entries of finger table. If there are fewer then
	 *         i+1 entries only these are returned.
	 */
	public List<Node> getFirstFingerTableEntries(int i) {
		return this.fingerTable.getFirstFingerTableEntries(i);
	}

	/**
	 * Added by sven on 21.03.2006. This data strucutre is supposed to work with
	 * remote references therefore it must be instances of Proxy. This method is
	 * used in every method that adds a new reference to this to check that it
	 * is an instance of Proxy. -> TODO: Consider to change type of all Nodes
	 * within this data structure to type Proxy!!!!
	 * 
	 * @param node
	 * @throws RuntimeException
	 */
	private void checkIfProxy(Node node) {
		if (!(node instanceof Proxy)) {
			String msg = "Trying to use local node " + node
					+ " with references. This is not possible."
					+ "If you see this Exception contact the developers!";
			RuntimeException e = new RuntimeException(msg);
			this.logger.fatal(msg, e);
			throw e;
		}
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
性久久久久久久久| 一区二区三区中文字幕电影| 欧美私模裸体表演在线观看| 美女视频网站黄色亚洲| 一区二区免费在线播放| 国产日韩在线不卡| 91精品福利在线一区二区三区 | 久久久久久**毛片大全| 欧美日韩国产片| www.久久精品| 韩国女主播成人在线| 午夜成人免费视频| 一区二区三区四区不卡视频| 国产农村妇女毛片精品久久麻豆| 91麻豆精品国产无毒不卡在线观看| av一区二区三区四区| 国产一区日韩二区欧美三区| 青青草国产成人av片免费| 亚洲免费av网站| 中文字幕中文字幕一区| 国产亚洲精品aa| 精品国产区一区| 欧美一区二区三区视频免费| 欧美人狂配大交3d怪物一区| 在线视频欧美区| 91啪亚洲精品| 91无套直看片红桃| 成人免费毛片片v| 国产不卡高清在线观看视频| 国产精品一区二区你懂的| 久久精工是国产品牌吗| 免费看欧美女人艹b| 石原莉奈在线亚洲三区| 天堂在线亚洲视频| 日本va欧美va精品| 日韩电影在线看| 日本三级亚洲精品| 青草av.久久免费一区| 日韩不卡手机在线v区| 日本在线播放一区二区三区| 日韩中文字幕亚洲一区二区va在线| 午夜精品久久久久久久久久久| 亚洲最色的网站| 午夜精品久久一牛影视| 婷婷成人综合网| 另类综合日韩欧美亚洲| 韩国女主播一区二区三区| 国内精品久久久久影院色| 国产一区二区调教| 成人精品国产一区二区4080| 成人h精品动漫一区二区三区| a在线播放不卡| 欧美午夜电影网| 日韩欧美一级二级三级久久久| 欧美成人官网二区| 欧美激情一区不卡| 亚洲激情自拍视频| 午夜欧美电影在线观看| 麻豆国产精品视频| 国产不卡视频一区| 在线免费观看成人短视频| 欧美日本韩国一区二区三区视频 | 国产一区二区伦理片| 成人动漫视频在线| 欧美亚洲综合色| 欧美一区二区在线播放| 久久精品亚洲精品国产欧美kt∨| 国产精品国产三级国产a| 亚洲成人av资源| 黄一区二区三区| 色婷婷av一区二区三区大白胸| 欧美日韩高清在线| 久久久久久毛片| 一个色综合网站| 国内偷窥港台综合视频在线播放| 不卡av在线网| 91精品国产色综合久久| 国产精品久久夜| 午夜精品福利久久久| 福利一区二区在线| 在线视频亚洲一区| 国产亚洲一二三区| 午夜视频一区二区| 夫妻av一区二区| 日韩午夜激情视频| 国产精品久久久99| 蜜桃在线一区二区三区| 91网站黄www| 精品国产免费视频| 亚洲愉拍自拍另类高清精品| 激情综合色综合久久| 91日韩精品一区| 国产性天天综合网| 日韩精品视频网| 成年人国产精品| 日韩欧美国产午夜精品| 亚洲精品菠萝久久久久久久| 国产一区不卡视频| 欧美一区二区三区性视频| 中文字幕中文字幕一区二区 | 99久久伊人精品| 91精品在线观看入口| 亚洲人妖av一区二区| 韩国三级电影一区二区| 欧美剧在线免费观看网站| 国产精品久久久久久久久晋中| 免费看欧美美女黄的网站| 欧美亚洲国产一区在线观看网站| 国产精品亲子伦对白| 激情久久久久久久久久久久久久久久| 91福利视频网站| 亚洲色图视频网站| 成人免费高清视频在线观看| 精品不卡在线视频| 免费成人av资源网| 欧美精品123区| 洋洋av久久久久久久一区| 99精品视频一区二区| 亚洲国产精品ⅴa在线观看| 精品综合久久久久久8888| 欧美高清视频一二三区| 亚洲午夜精品在线| 在线影视一区二区三区| 亚洲欧美激情在线| k8久久久一区二区三区 | 久久久精品免费网站| 美女国产一区二区| 欧美一区二区三区视频| 日韩精品乱码免费| 制服丝袜亚洲网站| 日韩二区在线观看| 日韩免费在线观看| 激情久久五月天| 国产亚洲精品7777| 成人网在线免费视频| 欧美高清在线精品一区| 成人不卡免费av| 《视频一区视频二区| 99re热这里只有精品视频| 中文字幕中文字幕一区| 色悠久久久久综合欧美99| 大尺度一区二区| 中文字幕一区二区三区在线观看| bt欧美亚洲午夜电影天堂| 亚洲色图色小说| 欧美日韩综合在线| 日本vs亚洲vs韩国一区三区二区 | 成人一二三区视频| 国产精品久久久久婷婷二区次| yourporn久久国产精品| 亚洲欧美一区二区三区国产精品| 色婷婷久久99综合精品jk白丝| 亚洲一区二区三区在线| 欧美另类z0zxhd电影| 男男视频亚洲欧美| 久久久久久97三级| 91在线丨porny丨国产| 一区二区在线看| 91精品国产乱码久久蜜臀| 久久91精品久久久久久秒播 | 夜夜亚洲天天久久| 在线播放/欧美激情| 国模一区二区三区白浆| 国产精品色哟哟网站| 91成人国产精品| 青青草原综合久久大伊人精品优势 | 国产麻豆一精品一av一免费| 中文字幕欧美一区| 欧美日韩亚洲高清一区二区| 另类欧美日韩国产在线| 国产精品成人免费在线| 欧美麻豆精品久久久久久| 国产美女久久久久| 亚洲另类春色校园小说| 日韩欧美一卡二卡| 99久久精品免费观看| 蜜臀av亚洲一区中文字幕| 国产精品入口麻豆原神| 欧美日韩在线不卡| 国产精品一区免费在线观看| 一区二区三区不卡视频| 久久―日本道色综合久久 | 久久久99久久| 欧美中文字幕一二三区视频| 国产伦精品一区二区三区免费迷| 亚洲精品免费一二三区| 欧美精品一区二区三区四区| 91福利在线免费观看| 国产九色精品成人porny | 日本伊人色综合网| 国产精品久久毛片| 日韩一级免费一区| 91丨九色丨蝌蚪丨老版| 韩国一区二区在线观看| 亚洲一区二区在线观看视频| 中文字幕av一区二区三区| 91精品一区二区三区在线观看| 99v久久综合狠狠综合久久| 激情五月激情综合网| 亚洲国产精品欧美一二99|