io.netty.channel.Channel#id ( )源码实例Demo

下面列出了io.netty.channel.Channel#id ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: esjc   文件: SubscriptionManager.java
public void startSubscription(SubscriptionItem item, Channel connection) {
    checkNotNull(connection, "connection is null");

    if (item.isSubscribed) {
        logger.debug("StartSubscription REMOVING due to already subscribed {}.", item);
        removeSubscription(item);
        return;
    }

    item.correlationId = UUID.randomUUID();
    item.connectionId = connection.id();
    item.lastUpdated.update();

    activeSubscriptions.put(item.correlationId, item);

    if (!item.operation.subscribe(item.correlationId, connection)) {
        logger.debug("StartSubscription REMOVING AS COULD NOT SUBSCRIBE {}.", item);
        removeSubscription(item);
    } else {
        logger.debug("StartSubscription SUBSCRIBING {}.", item);
    }
}
 
源代码2 项目: zuul   文件: ChannelUtils.java
public static String channelInfoForLogging(Channel ch)
{
    if (ch == null) {
        return "null";
    }
    
    String channelInfo = ch.toString() 
            + ", active=" + ch.isActive()
            + ", open=" + ch.isOpen()
            + ", registered=" + ch.isRegistered()
            + ", writable=" + ch.isWritable()
            + ", id=" + ch.id();
    
    CurrentPassport passport = CurrentPassport.fromChannel(ch);
    return "Channel: " + channelInfo + ", Passport: " + String.valueOf(passport);
}
 
源代码3 项目: bitchat   文件: DefaultChannelListener.java
@Override
public void channelInactive(Channel channel) {
    ChannelId channelId = channel.id();
    channelManager.removeChannel(channelId);
    sessionManager.removeSession(channelId);
    SessionHelper.markOffline(channel);
    log.info("Remove an inactive Channel={}", channel);
}
 
源代码4 项目: esjc   文件: OperationManager.java
private void send(OperationItem item, Channel connection) {
    item.connectionId = connection.id();
    item.lastUpdated.update();
    activeOperations.put(item.correlationId, item);

    TcpPackage tcpPackage = item.operation.create(item.correlationId);

    logger.debug("send package {}, {}, {}.", tcpPackage.command, tcpPackage.correlationId, item);

    connection.writeAndFlush(tcpPackage);
}
 
源代码5 项目: sailfish-core   文件: AbstractNettyService.java
public void onExceptionCaught(Channel channel, Throwable cause) {
    String message = "Exception caught in netty's pipeline in channel " + channel.id();
    changeStatus(ServiceStatus.ERROR, message, cause);
    stop(message, cause);
}
 
源代码6 项目: activemq-artemis   文件: ActiveMQChannelHandler.java
protected static Object channelId(Channel channel) {
   return channel.id();
}
 
源代码7 项目: ChatServer   文件: LoginService.java
/**
 * 접속 사용자 정보 제거
 *
 * @param channel Netty 채널
 */
public void removeUser(Channel channel) {

	ChannelId channelId = channel.id();
	Map<ChannelId, String> channelIdUserIdMap = channelIdUserIdRepository.getChannelIdUserIdMap();
	String userId = channelIdUserIdMap.get(channelId);

	// 사용자 정보 제거
	if (!StringUtils.isEmpty(userId)) {

		userIdChannelRepository.getUserIdChannelMap().remove(userId);

		String roomId = userIdRoomIdRepository.getUserIdRoomIdMap().get(userId);

		// 룸 정보 제거
		if (!StringUtils.isEmpty(roomId)) {

			roomIdUserIdRepository.getRoomIdUserIdMap().remove(roomId, userId);
			userIdRoomIdRepository.getUserIdRoomIdMap().remove(userId);

		}

		channelIdUserIdMap.remove(channelId);

	}

}