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

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

?? notificationchannelconnections.java

?? 關于 RFID 讀寫器的相關內容
?? JAVA
字號:
/*
 * Copyright (C) 2007 ETH Zurich
 *
 * This file is part of Fosstrak (www.fosstrak.org).
 *
 * Fosstrak is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1, as published by the Free Software Foundation.
 *
 * Fosstrak is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with Fosstrak; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301  USA
 */

package org.fosstrak.reader.rprm.core.msg;

import java.io.IOException;
import java.net.ConnectException;
import java.net.ServerSocket;
import java.net.Socket;

import org.fosstrak.reader.rprm.core.msg.transport.Connection;
import org.fosstrak.reader.rprm.core.msg.transport.HttpConnection;
import org.fosstrak.reader.rprm.core.msg.transport.TCPConnection;
import org.fosstrak.reader.rprm.core.msg.transport.TCPNotificationListenConnection;
import org.apache.log4j.Logger;

/**
 * This class is used as a pool for notification channel connections. Every
 * NotificationChannel needs a connection to send the read reports to the host.
 * This class manages the <code>Connection</code> used for that purpose.
 * Connections are either persistent or non-persistent, which means that they
 * are destroied after the ReadReport is sent to the host system.
 * 
 * @author Andreas F黵er, ETH Zurich Switzerland, Winter 2005/06
 * 
 */
public class NotificationChannelConnections {
	// ====================================================================
	// ---------------------------- Fields ------------------------------//
	// ====================================================================

	/** The logger. */
	static private Logger log;

	/** The singleton instance of the <code>NotificationChannels</code>. */
	private static NotificationChannelConnections instance;

	/** The clients structure. */
	private Clients clients;

	/** The id sent with notification messages. */
	private static int messageId = 0;

	// ====================================================================
	// ----------------------- Constructors -----------------------------//
	// ====================================================================

	/**
	 * Constructor
	 */
	protected NotificationChannelConnections() {
		log = Logger.getLogger(getClass().getName());
		clients = Clients.getInstance();
	}

	// ====================================================================
	// ------------------------- Methods --------------------------------//
	// ====================================================================

	/**
	 * Returns the single Instance of a <code>NotificationChannels</code>.
	 * 
	 * @return The single instance of <code>NotificationChannels</code>.
	 */
	public static NotificationChannelConnections getInstance() {
		if (instance == null) {
			instance = new NotificationChannelConnections();
		}
		return instance;
	}

	/**
	 * Create a new notification channel and add it to the
	 * <code>NotificationChannels</code>. Also a new <code>Connection</code>
	 * using the <code>format</code> message format for serializing the
	 * messages is instantiated.
	 * 
	 * @param name
	 *            The name of the notification channel
	 * @param address
	 *            The address of the host to send the notifications.
	 * @param senderHandshake
	 *            The handshake of the request.
	 * @param receiverHandshake
	 *            The handshake of the response
	 */
	public void create(final String name, final Address address,
			final SenderHandshakeMessage senderHandshake,
			final ReceiverHandshakeMessage receiverHandshake) {
		try {
			Connection conn = null;
			if (address.getProtocol().equals(MessagingConstants.PROTOCOL_TCP)) {
				// use a TCP connection
				if (address.getMode() != null
						&& address.getMode().equals(Address.MODE_LISTEN)) {
					// listen mode
					ServerSocket serverSocket = new ServerSocket(address
							.getPort());
					conn = new TCPNotificationListenConnection(serverSocket);
				} else {
					// connect mode
					Socket socket = new Socket(address.getHost(), address
							.getPort());
					conn = new TCPConnection(socket);
				}

			} else if (address.getProtocol().equals(
					MessagingConstants.PROTOCOL_HTTP)) {
				// use a HTTP connection
				Socket socket = new Socket(address.getHost(), address.getPort());
				conn = new HttpConnection(socket);
			} else {
				log.error("Wrong transport protocol " + address.getProtocol()
						+ ". Only TCP and HTTP are supported.");
				return;
			}

			conn.setSenderHandshake(senderHandshake);
			conn.setReceiverHandshake(receiverHandshake);
			log.debug("adding notification client " + address.toString()
					+ " to the clients.");
			clients.addNotificationClient(address.toString(), name, conn);

		} catch (ConnectException e) {
			log.error("NotificationChannel refused. Cannot connect with host "
					+ address.toString());
		} catch (IOException e) {
			log.error(e);
		}
	}

	/**
	 * Closes a notification channel and removes it from the
	 * <code>Clients</code>.
	 * 
	 * @param conn
	 *            The connection used to send the notifications.
	 */
	public void close(Connection conn) {
		conn.close();
		clients.removeClient(conn);
	}

	/**
	 * Gets the message format of a notification channel.
	 * 
	 * @param name
	 *            The name of the notification channel.
	 * @return The <code>MessageFormat</code> to use as the format for
	 *         serializing the message.
	 */
	public MessageFormat getChannelFormat(final String name) {
		String clientID = clients.getNotificationChannelClientID(name);
		Connection conn = clients.getConnection(clientID);
		return conn.getReceiverMessageFormat();
	}

	/**
	 * Gets the the ID which are used in the message to identify a specific
	 * message (e.g., in the ACK process). The id is automatically increased.
	 * 
	 * @return the next id to use as a message id.
	 */
	public synchronized static int nextMessageId() {
		messageId++;
		return messageId;
	}

	/**
	 * Resets all NotificationChannelConnections.
	 */
	public void reset() {
		instance = null;
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品一区二区| 91精品欧美一区二区三区综合在| 久久99精品久久只有精品| 中文字幕在线观看不卡视频| 久久九九全国免费| 久久网站最新地址| 久久久久高清精品| 欧美激情一区二区| 亚洲欧美日韩一区二区三区在线观看| 国产精品久久777777| 日韩美女精品在线| 亚洲午夜精品17c| 天天影视涩香欲综合网 | 九九国产精品视频| 精品亚洲成av人在线观看| 久久国产精品露脸对白| 国产精品18久久久久久vr| 国产成人免费网站| caoporn国产精品| 在线观看精品一区| 在线电影一区二区三区| 欧美xxxxxxxx| 综合av第一页| 日本麻豆一区二区三区视频| 久久激五月天综合精品| 国产sm精品调教视频网站| 91网上在线视频| 日韩欧美一级精品久久| 国产精品欧美一级免费| 亚洲国产精品视频| 国产在线乱码一区二区三区| 成人精品鲁一区一区二区| 欧美区一区二区三区| 久久这里只精品最新地址| 亚洲视频狠狠干| 免费看黄色91| 色综合夜色一区| 欧美成人一区二区三区片免费| 国产精品视频免费| 日韩在线一区二区| 99综合影院在线| 精品捆绑美女sm三区| 亚洲一区二区三区影院| 国产一区二区三区在线观看免费视频 | 91麻豆精品久久久久蜜臀 | 国产精品久久777777| 日本最新不卡在线| 成人黄色免费短视频| 日韩你懂的电影在线观看| 中文字幕亚洲精品在线观看| 六月丁香综合在线视频| 91福利在线看| 中文字幕欧美激情一区| 免费一级片91| 欧美人牲a欧美精品| 国产精品久久毛片| 经典三级一区二区| 欧美日韩激情在线| 一区二区三区四区不卡在线 | 国产一区二区在线免费观看| 91国产丝袜在线播放| 国产精品对白交换视频| 国产一区二区在线观看免费| 欧美一级片在线看| 五月婷婷综合网| 欧美综合在线视频| 亚洲综合在线免费观看| 成人av午夜电影| 国产精品理论片在线观看| 狠狠色狠狠色综合| www日韩大片| 久久99精品久久久久久久久久久久| 欧洲一区在线观看| 亚洲一区二区三区四区不卡| 91久久精品一区二区三| 一区二区三区中文免费| 91黄色免费看| 亚洲成人动漫在线免费观看| 精品视频在线视频| 亚洲高清免费在线| 91精品免费在线观看| 美女网站色91| 国产天堂亚洲国产碰碰| 高清在线观看日韩| 国产精品乱码一区二区三区软件 | 欧美日韩视频在线第一区 | 亚洲精品国久久99热| 一本色道久久综合精品竹菊| 亚洲欧洲综合另类在线| 色噜噜狠狠色综合欧洲selulu| 一区二区三区在线观看国产| 欧美性色黄大片手机版| 偷拍一区二区三区| 精品人伦一区二区色婷婷| 国产精品一区二区视频| 国产精品第一页第二页第三页| 97精品国产97久久久久久久久久久久 | 欧美日韩一区二区不卡| 久久精品国产第一区二区三区 | 成人18视频日本| 亚洲美女视频一区| 在线电影欧美成精品| 九色综合狠狠综合久久| 中文字幕一区二区三区色视频| 欧洲在线/亚洲| 狠狠色综合日日| 亚洲桃色在线一区| 91精品国产一区二区三区香蕉| 国产一区二区在线视频| 一区二区国产盗摄色噜噜| 日韩视频免费观看高清完整版在线观看 | 亚洲国产综合在线| 2023国产精品| 一本大道久久a久久精二百| 麻豆久久久久久| 亚洲精品成人a在线观看| 日韩欧美在线一区二区三区| 99re免费视频精品全部| 久久se这里有精品| 亚洲免费在线视频一区 二区| 欧美精品18+| 91在线视频观看| 国产一区二区日韩精品| 亚洲成人福利片| 亚洲欧美激情小说另类| 国产午夜精品一区二区三区嫩草| 欧美日韩一区二区三区四区五区| 成人性色生活片免费看爆迷你毛片| 亚洲成人动漫一区| 国产精品人人做人人爽人人添| 欧美精品久久久久久久多人混战| 99久久婷婷国产| 国产一区不卡在线| 日韩经典中文字幕一区| 18涩涩午夜精品.www| 久久精品在这里| 精品国产精品一区二区夜夜嗨| 91精品福利视频| 99国产精品国产精品毛片| 国产一区二区三区av电影| 麻豆国产精品官网| 日韩国产成人精品| 亚洲一区二区三区影院| 一区二区国产视频| 亚洲天堂a在线| 亚洲综合自拍偷拍| 一区二区高清在线| 一区二区三区不卡在线观看| 亚洲欧美日本在线| 亚洲另类在线制服丝袜| 中文字幕一区二区三区四区| 国产精品美女久久久久aⅴ | 日本少妇一区二区| 日韩综合在线视频| 日本成人中文字幕在线视频| 日韩国产一区二| 亚洲1区2区3区4区| 日本亚洲视频在线| 国内国产精品久久| 顶级嫩模精品视频在线看| 成人一区在线看| 波多野洁衣一区| 色哟哟一区二区在线观看| 色综合久久久久网| 欧美日韩一区二区三区免费看 | 久久精品国产久精国产| 国产综合色在线视频区| 国产福利不卡视频| 99热99精品| 欧美日韩一区二区三区四区| 欧美四级电影在线观看| 91精品国产色综合久久| 精品国产污网站| 国产精品久久毛片av大全日韩| 亚洲美女电影在线| 日韩精品乱码免费| 国产精品99精品久久免费| 97成人超碰视| 777亚洲妇女| 国产三级一区二区| 亚洲第一激情av| 九九精品一区二区| 色综合一区二区| 精品国产乱子伦一区| 国产精品色哟哟网站| 亚洲成av人片观看| 国产综合一区二区| 欧美视频一区二| 久久亚洲综合av| 亚洲一区电影777| 国产成人精品三级麻豆| 在线观看免费视频综合| 久久久久高清精品| 污片在线观看一区二区| 国产成人欧美日韩在线电影| 欧美色手机在线观看| 国产日本一区二区| 日日欢夜夜爽一区| 色婷婷av久久久久久久| 久久视频一区二区|