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

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

?? invocationthread.java

?? Chord package into p2psim
?? JAVA
字號:
/***************************************************************************
 *                                                                         *
 *                           InvocationThread.java                         *
 *                            -------------------                          *
 *   date                 : 01.09.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.socket;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

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

/**
 * This <code>Thread</code> is used to make a method invocation on a node that
 * is accessible through sockets over its {@link SocketEndpoint}.
 * 
 * @author sven
 * @version 1.0.5
 */
class InvocationThread implements Runnable {

	/**
	 * Name of property which defines the number of threads in pool created by
	 * {@link #createInvocationThreadPool()}.
	 */
	protected static final String CORE_POOL_SIZE_PROPERTY_NAME = InvocationThread.class
			.getName()
			+ ".corepoolsize";

	/**
	 * Name of property which defines the maximum number of threads in pool
	 * created by {@link #createInvocationThreadPool()}.
	 */
	protected static final String MAX_POOL_SIZE_PROPERTY_NAME = InvocationThread.class
			.getName()
			+ ".maxpoolsize";

	/**
	 * Name of property which defines the time the threads in pool created by
	 * {@link #createInvocationThreadPool()} can stay idle before being
	 * terminated.
	 */
	protected static final String KEEP_ALIVE_TIME_PROPERTY_NAME = InvocationThread.class
			.getName()
			+ ".keepalivetime";

	/**
	 * The number of core threads in ThreadPool created by
	 * {@link #createInvocationThreadPool()}.
	 */
	private static final int CORE_POOL_SIZE = Integer.parseInt(System
			.getProperty(CORE_POOL_SIZE_PROPERTY_NAME));

	/**
	 * The maximum number of threads in ThreadPool created by
	 * {@link #createInvocationThreadPool()}.
	 */
	private static final int MAX_POOL_SIZE = Integer.parseInt(System
			.getProperty(MAX_POOL_SIZE_PROPERTY_NAME));

	/**
	 * The time threads in ThreadPool created by
	 * {@link #createInvocationThreadPool()} can be idle before being
	 * terminated.
	 */
	private static final int KEEP_ALIVE_TIME = Integer.parseInt(System
			.getProperty(KEEP_ALIVE_TIME_PROPERTY_NAME));

	/**
	 * The logger for instances of this class.
	 */
	private static final Logger logger = Logger
			.getLogger(InvocationThread.class);

	private static final boolean debug = logger.isEnabledFor(DEBUG);

	/**
	 * The request that has to be handled by this InvocationThread. Represents
	 * the method to be invoked.
	 */
	private Request request;

	/**
	 * The {@link RequestHandler} that started this thread.
	 */
	private RequestHandler handler;

	/**
	 * The {@link ObjectOutputStream} to write the results of the invocation to.
	 */
	private ObjectOutputStream out;

	/**
	 * 
	 * @param handler1
	 *            Reference to {@link RequestHandler} that started this.
	 * @param request1
	 *            The {@link Request} that caused this invocation to be started.
	 * @param out1
	 *            The stream to which to write the result of the invocation.
	 */
	InvocationThread(RequestHandler handler1, Request request1,
			ObjectOutputStream out1) {
		this.handler = handler1;
		this.request = request1;
		this.out = out1;
		// schedule this for execution
		this.handler.getEndpoint().scheduleInvocation(this);
		if (debug) {
			logger.debug("InvocationThread scheduled for request " + request1);
		}
	}

	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("[Invocation of ");
		sb.append(MethodConstants.getMethodName(this.request.getRequestType()));
		sb.append("] Request: ");
		sb.append(this.request);
		return sb.toString();
	}

	/**
	 * This <code>run</code>-method invokes the Method that is assigned to it
	 * by {@link Request} provided in its
	 * {@link #InvocationThread(RequestHandler, Request, ObjectOutputStream) constructor}.
	 */
	public void run() {
		if (debug) {
			logger.debug(this + " started");
		}
		int requestType = this.request.getRequestType();
		String methodName = MethodConstants.getMethodName(requestType);
		if (debug) {
			logger.debug("Request received. Requested method: " + methodName);
		}
		/* and try to execute the requested method */
		try {
			if (debug) {
				logger.debug("Trying to invoke method " + methodName);
			}
			Serializable result = this.handler.invokeMethod(requestType,
					this.request.getParameters());
			/* Send result of requested method back to requestor. */
			Response response = new Response(Response.REQUEST_SUCCESSFUL,
					requestType, this.request.getReplyWith());
			response.setResult(result);
			synchronized (this.out) {
				this.out.writeObject(response);
				this.out.flush();
				this.out.reset();
			}
			logger.debug("Method invoked and result has been sent.");
		} catch (IOException e) {
			if (this.handler.connected) {
				logger.warn("Could not send response. Disconnecting!", e);
				this.handler.disconnect();
			}
			/* else socket has been closed */
		} catch (Exception t) {
			if (debug) {
				logger.debug("Throwable occured during execution of request "
						+ MethodConstants.getMethodName(requestType) + "!");
			}
			this.handler.sendFailureResponse(t, "Could not execute request! "
					+ "Reason unknown! Maybe this helps: " + t.getMessage(),
					this.request);
		}
//		this.request = null;
		this.handler = null;
		this.out = null;
		if (debug) {
			logger.debug(this + " finished");
		}
	}

	/**
	 * Creates a ThreadPool that is used by the {@link SocketEndpoint} to
	 * execute instances of this class.
	 * 
	 * @return A ThreadPool that is used by the {@link SocketEndpoint} to
	 *         execute instances of this class.
	 */
	static ThreadPoolExecutor createInvocationThreadPool() {
		return new ThreadPoolExecutor(CORE_POOL_SIZE, MAX_POOL_SIZE,
				KEEP_ALIVE_TIME, TimeUnit.SECONDS,
				new LinkedBlockingQueue<Runnable>(), new ThreadFactory() {

					private static final String name = "InvocationExecution-";

					public Thread newThread(Runnable r) {
						Thread newThread = new Thread(r);
						newThread.setName(name + newThread.getName());
						return newThread;
					}

				});
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线你懂的| 日本aⅴ免费视频一区二区三区 | 日本成人中文字幕| 看国产成人h片视频| 国产河南妇女毛片精品久久久 | 国产精品久久久久毛片软件| 亚洲伦理在线免费看| 国产精品一区免费视频| 成人av午夜影院| 欧美日韩一区二区三区在线看 | 午夜久久久久久| 成人av在线播放网址| 色综合一个色综合| 日韩欧美色综合| 亚洲免费在线播放| 国产精品一区二区久久不卡| 99精品在线免费| 麻豆精品一区二区三区| 久久久99精品免费观看| 免费观看30秒视频久久| 91久久精品国产91性色tv| 91精品国产手机| 一二三区精品视频| 欧美日韩你懂的| 韩国毛片一区二区三区| 91在线你懂得| 欧美亚洲动漫精品| 在线播放日韩导航| 欧美国产日韩在线观看| 国产精品天美传媒沈樵| 亚洲国产精品一区二区www | 中文字幕日本不卡| 亚洲中国最大av网站| 成人av影视在线观看| 国产欧美视频在线观看| 一本到一区二区三区| 无码av中文一区二区三区桃花岛| 欧美午夜精品久久久久久孕妇| 国产精品一级片| 亚洲激情图片一区| 色婷婷亚洲综合| 亚洲第一福利一区| 久久丝袜美腿综合| 丁香六月综合激情| 一区二区久久久| 色综合天天综合网国产成人综合天| 亚洲精品国产成人久久av盗摄| 成人高清视频在线| 欧美国产精品一区二区三区| 91亚洲国产成人精品一区二三| 在线播放91灌醉迷j高跟美女 | 91麻豆精品国产自产在线观看一区 | 欧美日韩国产片| 中文字幕在线不卡视频| 99久久久免费精品国产一区二区| 亚洲人妖av一区二区| 色美美综合视频| 亚洲国产一二三| 国产女人18水真多18精品一级做| 成人三级在线视频| 中文字幕不卡在线观看| 在线观看区一区二| 午夜精品在线视频一区| 欧美一区二区三区小说| 亚洲精品亚洲人成人网在线播放| 成人精品免费网站| 老司机午夜精品| 亚洲午夜在线视频| 国产欧美一区二区在线| 欧美激情在线一区二区三区| 久久国产精品一区二区| 日韩一区二区精品在线观看| 久久疯狂做爰流白浆xx| 欧美一区二区三区视频| 日韩经典一区二区| 91麻豆精品国产91久久久资源速度 | 日韩三级在线观看| 亚洲电影中文字幕在线观看| 色国产精品一区在线观看| 亚洲色大成网站www久久九九| 91视频在线观看免费| 最新国产の精品合集bt伙计| 成人动漫精品一区二区| 亚洲婷婷国产精品电影人久久| thepron国产精品| 中文字幕在线不卡一区| 色噜噜久久综合| 五月婷婷色综合| 欧美一区二区性放荡片| 另类人妖一区二区av| 精品国产电影一区二区| 国产成人午夜精品5599 | 91麻豆精品视频| 亚洲男同性恋视频| 欧美日韩一区二区在线视频| 日本亚洲一区二区| 久久影院午夜论| 成人福利视频在线| 一区二区三区中文字幕电影 | 免费成人在线播放| 2020国产精品| 91色porny蝌蚪| 天天操天天综合网| 久久综合色鬼综合色| 不卡一区二区三区四区| 亚洲男人电影天堂| 91超碰这里只有精品国产| 精品在线亚洲视频| 国产精品美女视频| 欧美在线不卡一区| 美国十次了思思久久精品导航| 国产婷婷色一区二区三区四区| 色综合久久中文字幕综合网| 亚洲成人精品影院| 久久久影视传媒| 色伊人久久综合中文字幕| 日韩精品欧美精品| 国产欧美在线观看一区| 欧美性色黄大片| 九一久久久久久| 亚洲天堂免费在线观看视频| 欧美一区二区三区四区五区| 国产成人av自拍| 亚洲成人1区2区| 久久精品人人爽人人爽| 91福利精品视频| 国产一区亚洲一区| 亚洲一区二区三区影院| 欧美精品一区男女天堂| 91色视频在线| 国产一区二三区| 一卡二卡欧美日韩| 久久嫩草精品久久久精品| 欧美日韩午夜在线| 国产99精品在线观看| 秋霞影院一区二区| 亚洲日本丝袜连裤袜办公室| 精品久久久久99| 欧美日韩久久一区| 99r国产精品| 国产中文字幕精品| 亚洲不卡一区二区三区| 亚洲国产精品ⅴa在线观看| 91麻豆精品91久久久久同性| 91在线视频免费91| 久久精品999| 亚洲国产精品久久久久秋霞影院 | 大白屁股一区二区视频| 奇米影视一区二区三区小说| 亚洲精品成人精品456| www久久久久| 宅男噜噜噜66一区二区66| 一本色道亚洲精品aⅴ| 懂色av一区二区在线播放| 日本网站在线观看一区二区三区| 亚洲精品视频一区| 国产欧美日本一区视频| 欧美mv日韩mv| 欧美一区二区性放荡片| 欧美日韩国产美| 91色porny在线视频| 成人少妇影院yyyy| 国产精品自拍一区| 久久国产精品99精品国产| 亚洲五月六月丁香激情| 亚洲色图欧美激情| 国产精品大尺度| 欧美国产一区视频在线观看| 久久人人爽人人爽| 久久美女艺术照精彩视频福利播放| 日韩欧美aaaaaa| 精品人在线二区三区| 日韩三级在线观看| 日韩精品专区在线| 日韩欧美国产一区二区三区 | 国产综合成人久久大片91| 蜜桃一区二区三区在线观看| 日韩国产欧美在线观看| 日韩精品成人一区二区三区| 日韩av电影免费观看高清完整版| 日韩精品成人一区二区在线| 日本亚洲欧美天堂免费| 蜜桃免费网站一区二区三区| 老汉av免费一区二区三区| 蜜桃视频在线观看一区| 蜜桃av一区二区三区| 另类小说色综合网站| 蜜臀av国产精品久久久久| 琪琪一区二区三区| 午夜精品久久久久| 日本网站在线观看一区二区三区| 亚洲成a人片综合在线| 日本亚洲视频在线| 日本人妖一区二区| 日韩和欧美的一区| 久草中文综合在线| 精品一区二区三区免费毛片爱 | 国产盗摄女厕一区二区三区| 狠狠色狠狠色综合日日91app| 免费日韩伦理电影|