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

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

?? chordimpl.java

?? Chord package into p2psim
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
		}

		// determine ID for key
		ID id = this.hashFunction.getHashKey(key);
		Entry entryToInsert = new Entry(id, s);

		boolean debug = this.logger.isEnabledFor(DEBUG);
		if (debug) {
			this.logger.debug("Inserting new entry with id " + id);
		}
		boolean inserted = false;
		while (!inserted) {
			// find successor of id
			Node responsibleNode;
			// try {
			responsibleNode = this.findSuccessor(id);

			if (debug) {
				this.logger.debug("Invoking insertEntry method on node "
						+ responsibleNode.getNodeID());
			}

			// invoke insertEntry method
			try {
				responsibleNode.insertEntry(entryToInsert);
				inserted = true;
			} catch (CommunicationException e1) {
				if (debug) {
					this.logger
							.debug(
									"An error occured while invoking the insertEntry method "
											+ " on the appropriate node! Insert operation "
											+ "failed!", e1);
				}
				continue;
			}
		}
		this.logger.debug("New entry was inserted!");
	}

	public final Set<Serializable> retrieve(Key key) {

		// check parameters
		if (key == null) {
			NullPointerException e = new NullPointerException(
					"Key must not have value null!");
			this.logger.error("Null pointer", e);
			throw e;
		}

		// determine ID for key
		ID id = this.hashFunction.getHashKey(key);

		boolean debug = this.logger.isEnabledFor(DEBUG);
		if (debug) {
			this.logger.debug("Retrieving entries with id " + id);
		}
		Set<Entry> result = null;

		boolean retrieved = false;
		while (!retrieved) {
			// find successor of id
			Node responsibleNode = null;

			responsibleNode = findSuccessor(id);

			// invoke retrieveEntry method
			try {
				result = responsibleNode.retrieveEntries(id);
				// cause while loop to end.

				retrieved = true;
			} catch (CommunicationException e1) {
				if (debug) {
					this.logger
							.debug(
									"An error occured while invoking the retrieveEntry method "
											+ " on the appropriate node! Retrieve operation "
											+ "failed!", e1);
				}
				continue;
			}
		}
		Set<Serializable> values = new HashSet<Serializable>();

		if (result != null) {
			for (Entry entry : result) {
				values.add(entry.getValue());
			}
		}

		this.logger.debug("Entries were retrieved!");

		return values;

	}

	public final void remove(Key key, Serializable s) {

		// check parameters
		if (key == null || s == null) {
			throw new NullPointerException(
					"Neither parameter may have value null!");
		}

		// determine ID for key
		ID id = this.hashFunction.getHashKey(key);
		Entry entryToRemove = new Entry(id, s);

		boolean removed = false;
		while (!removed) {

			boolean debug = this.logger.isEnabledFor(DEBUG);
			if (debug) {
				this.logger.debug("Removing entry with id " + id
						+ " and value " + s);
			}

			// find successor of id
			Node responsibleNode;
			responsibleNode = findSuccessor(id);

			if (debug) {
				this.logger.debug("Invoking removeEntry method on node "
						+ responsibleNode.getNodeID());
			}
			// invoke removeEntry method
			try {
				responsibleNode.removeEntry(entryToRemove);
				removed = true;
			} catch (CommunicationException e1) {
				if (debug) {
					this.logger
							.debug(
									"An error occured while invoking the removeEntry method "
											+ " on the appropriate node! Remove operation "
											+ "failed!", e1);
				}
				continue;
			}
		}
		this.logger.debug("Entry was removed!");
	}

	/**
	 * Returns a human-readable string representation containing this node's
	 * node ID and URL.
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public final String toString() {
		return "Chord node: id = "
				+ (this.localID == null ? "null" : this.localID.toString())
				+ ", url = "
				+ (this.localURL == null ? "null" : this.localURL.toString()
						+ "\n");
	}

	/**
	 * Returns the Chord node which is responsible for the given key.
	 * 
	 * @param key
	 *            Key for which the successor is searched for.
	 * @throws NullPointerException
	 *             If given ID is <code>null</code>.
	 * @return Responsible node.
	 */
	final Node findSuccessor(ID key) {

		if (key == null) {
			NullPointerException e = new NullPointerException(
					"ID to find successor for may not be null!");
			this.logger.error("Null pointer.", e);
			throw e;
		}

		boolean debug = this.logger.isEnabledFor(DEBUG);

		// check if the local node is the only node in the network
		Node successor = this.references.getSuccessor();
		if (successor == null) {

			if (this.logger.isEnabledFor(INFO)) {
				this.logger
						.info("I appear to be the only node in the network, so I am "
								+ "my own "
								+ "successor; return reference on me: "
								+ this.getID());
			}
			return this.localNode;
		}
		// check if the key to look up lies between this node and its successor
		else if (key.isInInterval(this.getID(), successor.getNodeID())
				|| key.equals(successor.getNodeID())) {
			if (debug) {
				this.logger
						.debug("The requested key lies between my own and my "
								+ "successor's node id; therefore return my successor.");
			}

			// try to reach successor
			try {
				// successor.ping(); // if methods returns, successor is alive.
				// ping removed on 17.09.2007. sven
				if (debug) {
					this.logger.debug("Returning my successor "
							+ successor.getNodeID() + " of type "
							+ successor.getClass());
				}
				return successor;
			} catch (Exception e) {
				// not successful, delete node from successor list and finger
				// table, and set new successor, if available
				this.logger
						.warn("Successor did not respond! Removing it from all "
								+ "lists and retrying...");
				this.references.removeReference(successor);
				return findSuccessor(key);
			}
		}

		// ask closest preceding node found in local references for closest
		// preceding node concerning the key to look up
		else {

			Node closestPrecedingNode = this.references
					.getClosestPrecedingNode(key);

			try {
				if (debug) {
					this.logger
							.debug("Asking closest preceding node known to this node for closest preceding node "
									+ closestPrecedingNode.getNodeID()
									+ " concerning key " + key + " to look up");
				}
				return closestPrecedingNode.findSuccessor(key);
			} catch (CommunicationException e) {
				this.logger
						.error("Communication failure while requesting successor "
								+ "for key "
								+ key
								+ " from node "
								+ closestPrecedingNode.toString()
								+ " - looking up successor for failed node "
								+ closestPrecedingNode.toString());
				this.references.removeReference(closestPrecedingNode);
				return findSuccessor(key);
			}
		}
	}

	/* Implementation of Report interface */
	public final String printEntries() {
		return this.entries.toString();
	}

	public final String printFingerTable() {
		return this.references.printFingerTable();
	}

	public final String printSuccessorList() {
		return this.references.printSuccessorList();
	}

	public final String printReferences() {
		return this.references.toString();
	}

	public final String printPredecessor() {
		Node pre = this.references.getPredecessor();
		if (pre == null) {
			return "Predecessor: null";
		} else {
			return "Predecessor: " + pre.toString();
		}
	}

	public void retrieve(final Key key, final ChordCallback callback) {
		final Chord chord = this;
		this.asyncExecutor.execute(new Runnable() {
			public void run() {
				Throwable t = null;
				Set<Serializable> result = null;
				try {
					result = chord.retrieve(key);
				} catch (ServiceException e) {
					t = e;
				} catch (Throwable th) {
					t = th;
				}
				callback.retrieved(key, result, t);
			}
		});
	}

	public void insert(final Key key, final Serializable entry,
			final ChordCallback callback) {
		final Chord chord = this;
		this.asyncExecutor.execute(new Runnable() {
			public void run() {
				Throwable t = null;
				try {
					chord.insert(key, entry);
				} catch (ServiceException e) {
					t = e;
				} catch (Throwable th) {
					t = th;
				}
				callback.inserted(key, entry, t);
			}
		});
	}

	public void remove(final Key key, final Serializable entry,
			final ChordCallback callback) {
		final Chord chord = this;
		this.asyncExecutor.execute(new Runnable() {
			public void run() {
				Throwable t = null;
				try {
					chord.remove(key, entry);
				} catch (ServiceException e) {
					t = e;
				} catch (Throwable th) {
					t = th;
				}
				callback.removed(key, entry, t);
			}
		});
	}

	public ChordRetrievalFuture retrieveAsync(Key key) {
		return ChordRetrievalFutureImpl.create(this.asyncExecutor, this, key);
	}

	public ChordFuture insertAsync(Key key, Serializable entry) {
		return ChordInsertFuture.create(this.asyncExecutor, this, key, entry);
	}

	public ChordFuture removeAsync(Key key, Serializable entry) {
		return ChordRemoveFuture.create(this.asyncExecutor, this, key, entry);
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
五月天亚洲婷婷| 91欧美一区二区| 97国产一区二区| 在线综合+亚洲+欧美中文字幕| 久久久久国产精品厨房| 亚洲成人三级小说| 波多野洁衣一区| 久久一区二区视频| 日韩专区一卡二卡| 91福利在线免费观看| 久久久久久久久久久久久女国产乱 | 中文一区二区在线观看| 日韩av不卡在线观看| 91成人在线免费观看| 久久这里都是精品| 天天色图综合网| 色婷婷综合中文久久一本| 国产女人水真多18毛片18精品视频| 午夜精品免费在线观看| 欧美在线三级电影| 亚洲免费观看高清在线观看| 不卡av在线网| 国产精品私人自拍| 国产成人综合网| 国产婷婷色一区二区三区四区| 国模一区二区三区白浆| 日韩一区二区电影网| 日韩国产在线观看一区| 欧美在线制服丝袜| 男女男精品视频| 国产高清不卡一区二区| 国产精品资源站在线| 精品国精品自拍自在线| 琪琪一区二区三区| 精品久久人人做人人爰| 久久成人免费网站| 精品成人a区在线观看| 国产真实乱子伦精品视频| 久久久亚洲欧洲日产国码αv| 国产呦精品一区二区三区网站| 精品日韩成人av| 国产精品一区二区三区网站| 国产精品网站导航| 91在线视频18| 亚洲一区二区在线视频| 欧美精选一区二区| 日本亚洲一区二区| 久久午夜国产精品| 不卡高清视频专区| 亚洲一区二区综合| 欧美mv日韩mv国产网站app| 国产乱妇无码大片在线观看| 亚洲色图丝袜美腿| 欧美顶级少妇做爰| 国产乱色国产精品免费视频| 亚洲人成网站色在线观看| 欧美三区在线视频| 国产高清久久久| 一区二区视频在线看| 91精品综合久久久久久| 国产成人aaaa| 亚洲小少妇裸体bbw| 精品国产乱码久久久久久夜甘婷婷 | 欧美一区二区三区在线视频| 激情五月播播久久久精品| 中文字幕亚洲区| 欧美乱熟臀69xxxxxx| 国产一区二区三区不卡在线观看| 日韩毛片视频在线看| 欧美三级欧美一级| 国产精品系列在线观看| 一个色妞综合视频在线观看| 日韩欧美123| 欧美日韩国产系列| 激情文学综合丁香| 一区二区三区久久| 国产欧美日韩卡一| 欧美理论电影在线| 日本乱人伦一区| 国产成人自拍高清视频在线免费播放 | 日本亚洲欧美天堂免费| 国产精品久久网站| 精品美女一区二区| 在线看国产日韩| 成人一级视频在线观看| 日韩精品五月天| 亚洲毛片av在线| 国产精品久久久久一区二区三区共| 蜜臀av性久久久久蜜臀aⅴ| 国产精品系列在线观看| 亚洲一区影音先锋| 国产精品美女久久久久久久| 91精品国产一区二区| 在线免费不卡电影| 91在线看国产| www.亚洲激情.com| 国产成人在线影院| 国产高清在线精品| 国产在线视频精品一区| 美女精品自拍一二三四| 日日夜夜精品视频免费 | 日韩欧美中文字幕精品| 欧美性三三影院| 在线中文字幕一区| 在线观看免费一区| 色综合视频在线观看| 91视频在线看| 99精品欧美一区二区三区综合在线| 狠狠色伊人亚洲综合成人| 玖玖九九国产精品| 久久99日本精品| 久久国产精品第一页| 精品亚洲免费视频| 精品在线一区二区三区| 麻豆精品精品国产自在97香蕉| 日韩av在线播放中文字幕| 日本伊人色综合网| 国产真实乱偷精品视频免| 国精产品一区一区三区mba视频| 激情五月播播久久久精品| 九九**精品视频免费播放| 狠狠色丁香婷综合久久| 国产主播一区二区三区| 国产成a人无v码亚洲福利| 国产成人三级在线观看| 精品一区二区免费在线观看| 国产麻豆一精品一av一免费| 国产精品一区不卡| k8久久久一区二区三区| 色狠狠一区二区| 67194成人在线观看| 日韩视频免费观看高清完整版 | 中文字幕一区在线观看视频| 国产精品国产三级国产普通话99| 亚洲欧洲美洲综合色网| 亚洲一区二区三区小说| 香蕉成人伊视频在线观看| 捆绑调教美女网站视频一区| 精品一区二区三区欧美| 从欧美一区二区三区| 91传媒视频在线播放| 欧美一区2区视频在线观看| 久久久99久久| 亚洲男同1069视频| 精品在线一区二区三区| 91色综合久久久久婷婷| 91精品国产欧美一区二区成人| 日韩免费在线观看| 国产精品伦一区| 青草av.久久免费一区| 成人高清视频在线观看| 欧美日本国产视频| 国产精品无遮挡| 日韩国产精品91| 成人v精品蜜桃久久一区| 欧美老人xxxx18| 国产欧美精品一区aⅴ影院| 一区二区在线看| 亚洲丝袜精品丝袜在线| 五月婷婷综合在线| 久久99九九99精品| 日本丶国产丶欧美色综合| 欧美一区二区三区四区在线观看| 国产欧美在线观看一区| 午夜欧美一区二区三区在线播放 | 欧美国产一区视频在线观看| 亚洲男女一区二区三区| 亚洲人成小说网站色在线 | 亚洲第一电影网| 国产91精品在线观看| 欧美情侣在线播放| 中文字幕亚洲一区二区va在线| 精品一区二区三区影院在线午夜 | 一本色道久久综合亚洲aⅴ蜜桃| 日韩精品自拍偷拍| 午夜久久久久久| 99久久久国产精品免费蜜臀| 精品国产精品一区二区夜夜嗨| 国产成人在线免费观看| 国产美女精品人人做人人爽| 色网综合在线观看| 日韩三级视频在线看| 亚洲一二三级电影| 91在线观看地址| 国产精品视频一二三区| 加勒比av一区二区| 欧美一级免费大片| 午夜精品久久久久久久蜜桃app| 色综合久久久久网| 亚洲男人的天堂av| 色94色欧美sute亚洲线路二| 中文字幕一区二区在线播放| 国产精品69毛片高清亚洲| 精品久久久久久久久久久久久久久久久 | 国产一区二区三区香蕉| 欧美疯狂做受xxxx富婆| 亚洲成a人片在线观看中文| 日本韩国一区二区| 亚洲综合一区在线| 在线中文字幕一区二区|