热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.jboss.netty.channel.ChannelStateEvent.getChannel()方法的使用及代码示例

本文整理了Java中org.jboss.netty.channel.ChannelStateEvent.getChannel()方法的一些代码示例,展示了C

本文整理了Java中org.jboss.netty.channel.ChannelStateEvent.getChannel()方法的一些代码示例,展示了ChannelStateEvent.getChannel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ChannelStateEvent.getChannel()方法的具体详情如下:
包路径:org.jboss.netty.channel.ChannelStateEvent
类名称:ChannelStateEvent
方法名:getChannel

ChannelStateEvent.getChannel介绍

暂无

代码示例

代码示例来源:origin: alibaba/jstorm

@Override
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) {
LOG.info("Connection established {}", e.getChannel().getRemoteAddress());
server.addChannel(e.getChannel());
}

代码示例来源:origin: alibaba/jstorm

@Override
public void channelInterestChanged(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
client.notifyInterestChanged(e.getChannel());
}
}

代码示例来源:origin: MovingBlocks/Terasology

@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) {
networkSystem.registerChannel(e.getChannel());
}

代码示例来源:origin: alibaba/jstorm

@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
super.channelClosed(ctx, e);
LOG.info("Connection channelClosed {}", e.getChannel().getRemoteAddress());
MessageDecoder.removeTransmitHistogram(e.getChannel());
}

代码示例来源:origin: menacher/java-game-server

@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
throws Exception {
AbstractNettyServer.ALL_CHANNELS.add(e.getChannel());
LOG.debug("Added Channel with id: {} as the {}th open channel", e
.getChannel().getId(), CHANNEL_COUNTER.incrementAndGet());
}

代码示例来源:origin: alibaba/jstorm

/**
* @see org.jboss.netty.channel.SimpleChannelUpstreamHandler#channelDisconnected(org.jboss.netty.channel.ChannelHandlerContext,
* org.jboss.netty.channel.ChannelStateEvent)
*/
@Override
public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
LOG.info("Receive channelDisconnected to {}, channel = {}", client.getRemoteAddr(), e.getChannel());
// ctx.sendUpstream(e);
super.channelDisconnected(ctx, e);
client.disconnectChannel(e.getChannel());
}

代码示例来源:origin: alibaba/jstorm

@Override
public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
super.channelDisconnected(ctx, e);
LOG.info("Connection channelDisconnected {}", e.getChannel().getRemoteAddress());
MessageDecoder.removeTransmitHistogram(e.getChannel());
server.getChannelGroup().remove(e.getChannel());
}

代码示例来源:origin: alibaba/jstorm

@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
LOG.info("Connection to {} has been closed, channel = {}", client.getRemoteAddr(), e.getChannel());
super.channelClosed(ctx, e);
}

代码示例来源:origin: apache/avro

@Override
public void channelClosed(
ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
LOG.info("Connection to {} disconnected.",
e.getChannel().getRemoteAddress());
super.channelClosed(ctx, e);
e.getChannel().close();
allChannels.remove(e.getChannel());
}

代码示例来源:origin: apache/hive

@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent evt)
throws Exception {
if ((maxShuffleConnections > 0) && (accepted.size() >= maxShuffleConnections)) {
LOG.info(String.format("Current number of shuffle connections (%d) is " +
"greater than or equal to the max allowed shuffle connections (%d)",
accepted.size(), maxShuffleConnections));
evt.getChannel().close();
return;
}
accepted.add(evt.getChannel());
super.channelOpen(ctx, evt);
}

代码示例来源:origin: apache/avro

@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
throws Exception {
allChannels.add(e.getChannel());
super.channelOpen(ctx, e);
}

代码示例来源:origin: menacher/java-game-server

@Override
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e)
throws Exception
{
NettyTCPClient.ALL_CHANNELS.add(e.getChannel());
super.channelConnected(ctx, e);
}

代码示例来源:origin: voldemort/voldemort

@Override
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
connectionStats.reportChannelConnect();
if(allchannels != null) {
allchannels.add(e.getChannel());
}
ctx.sendUpstream(e);
}

代码示例来源:origin: menacher/java-game-server

@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
throws Exception
{
DatagramChannel datagramChannel = (DatagramChannel) e.getChannel();
Session session = NettyUDPClient.CLIENTS.get(datagramChannel
.getLocalAddress());
if ((null != session) && !session.isShuttingDown())
{
Event event = Events.event(e, Events.DISCONNECT);
session.onEvent(event);
}
}

代码示例来源:origin: menacher/java-game-server

@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
throws Exception
{
LOG.debug("Netty Channel {} is closed.", e.getChannel().getId());
if (!playerSession.isShuttingDown())
{
// Should not send close to session, since reconnection/other
// business logic might be in place.
Event event = Events.event(e, Events.DISCONNECT);
playerSession.onEvent(event);
}
}

代码示例来源:origin: MovingBlocks/Terasology

@Override
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
logger.info("Sending Server Hello");
PublicIdentityCertificate serverPublicCert = config.getSecurity().getServerPublicCertificate();
new SecureRandom().nextBytes(serverRandom);
serverHello = NetData.HandshakeHello.newBuilder()
.setRandom(ByteString.copyFrom(serverRandom))
.setCertificate(NetMessageUtil.convert(serverPublicCert))
.setTimestamp(System.currentTimeMillis())
.build();
e.getChannel().write(NetData.NetMessage.newBuilder()
.setHandshakeHello(serverHello)
.build());
}

代码示例来源:origin: alibaba/jstorm

/**
* Sometime when connecting to a bad channel which isn't writable, this method will be called
*/
@Override
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent event) {
// register the newly established channel
Channel channel = event.getChannel();
LOG.info("connection established to :{}, local port:{}", client.getRemoteAddr(), channel.getLocalAddress());
client.connectChannel(ctx.getChannel());
client.handleResponse(ctx.getChannel(), null);
}

代码示例来源:origin: io.netty/netty

private void sendGoAwayFrame(ChannelHandlerContext ctx, ChannelStateEvent e) {
// Avoid NotYetConnectedException
if (!e.getChannel().isConnected()) {
ctx.sendDownstream(e);
return;
}
ChannelFuture future = sendGoAwayFrame(ctx, e.getChannel(), null, SpdySessionStatus.OK);
if (spdySession.noActiveStreams()) {
future.addListener(new ClosingChannelFutureListener(ctx, e));
} else {
closeSessiOnFutureListener= new ClosingChannelFutureListener(ctx, e);
}
}

代码示例来源:origin: menacher/java-game-server

@Override
public void channelDisconnected(ChannelHandlerContext ctx,
ChannelStateEvent e) throws Exception
{
DatagramChannel datagramChannel = (DatagramChannel) e.getChannel();
Session session = NettyUDPClient.CLIENTS.get(datagramChannel
.getLocalAddress());
if ((null != session) && !session.isShuttingDown())
{
Event event = Events.event(e, Events.DISCONNECT);
session.onEvent(event);
}
else if (null != session)
{
System.out.println("Session is already shutting down. "
+ "Disconnect event will be discarded for channel {}"
+ datagramChannel.getId());
}
}

代码示例来源:origin: io.netty/netty

@Override
public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
// Make sure the handshake future is notified when a connection has
// been closed during handshake.
synchronized (handshakeLock) {
if (handshaking) {
cancelHandshakeTimeout();
handshakeFuture.setFailure(new ClosedChannelException());
}
}
try {
super.channelDisconnected(ctx, e);
} finally {
unwrapNonAppData(ctx, e.getChannel(), false);
closeEngine();
}
}

推荐阅读
  • 本文介绍了一些Java开发项目管理工具及其配置教程,包括团队协同工具worktil,版本管理工具GitLab,自动化构建工具Jenkins,项目管理工具Maven和Maven私服Nexus,以及Mybatis的安装和代码自动生成工具。提供了相关链接供读者参考。 ... [详细]
  • 标题: ... [详细]
  • 本文介绍了在Linux下安装和配置Kafka的方法,包括安装JDK、下载和解压Kafka、配置Kafka的参数,以及配置Kafka的日志目录、服务器IP和日志存放路径等。同时还提供了单机配置部署的方法和zookeeper地址和端口的配置。通过实操成功的案例,帮助读者快速完成Kafka的安装和配置。 ... [详细]
  • 本文介绍了在开发Android新闻App时,搭建本地服务器的步骤。通过使用XAMPP软件,可以一键式搭建起开发环境,包括Apache、MySQL、PHP、PERL。在本地服务器上新建数据库和表,并设置相应的属性。最后,给出了创建new表的SQL语句。这个教程适合初学者参考。 ... [详细]
  • PHP图片截取方法及应用实例
    本文介绍了使用PHP动态切割JPEG图片的方法,并提供了应用实例,包括截取视频图、提取文章内容中的图片地址、裁切图片等问题。详细介绍了相关的PHP函数和参数的使用,以及图片切割的具体步骤。同时,还提供了一些注意事项和优化建议。通过本文的学习,读者可以掌握PHP图片截取的技巧,实现自己的需求。 ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • 本文介绍了如何使用php限制数据库插入的条数并显示每次插入数据库之间的数据数目,以及避免重复提交的方法。同时还介绍了如何限制某一个数据库用户的并发连接数,以及设置数据库的连接数和连接超时时间的方法。最后提供了一些关于浏览器在线用户数和数据库连接数量比例的参考值。 ... [详细]
  • 如何使用Java获取服务器硬件信息和磁盘负载率
    本文介绍了使用Java编程语言获取服务器硬件信息和磁盘负载率的方法。首先在远程服务器上搭建一个支持服务端语言的HTTP服务,并获取服务器的磁盘信息,并将结果输出。然后在本地使用JS编写一个AJAX脚本,远程请求服务端的程序,得到结果并展示给用户。其中还介绍了如何提取硬盘序列号的方法。 ... [详细]
  • 本文介绍了C#中数据集DataSet对象的使用及相关方法详解,包括DataSet对象的概述、与数据关系对象的互联、Rows集合和Columns集合的组成,以及DataSet对象常用的方法之一——Merge方法的使用。通过本文的阅读,读者可以了解到DataSet对象在C#中的重要性和使用方法。 ... [详细]
  • 1,关于死锁的理解死锁,我们可以简单的理解为是两个线程同时使用同一资源,两个线程又得不到相应的资源而造成永无相互等待的情况。 2,模拟死锁背景介绍:我们创建一个朋友 ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • 本文介绍了RPC框架Thrift的安装环境变量配置与第一个实例,讲解了RPC的概念以及如何解决跨语言、c++客户端、web服务端、远程调用等需求。Thrift开发方便上手快,性能和稳定性也不错,适合初学者学习和使用。 ... [详细]
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
  • 《数据结构》学习笔记3——串匹配算法性能评估
    本文主要讨论串匹配算法的性能评估,包括模式匹配、字符种类数量、算法复杂度等内容。通过借助C++中的头文件和库,可以实现对串的匹配操作。其中蛮力算法的复杂度为O(m*n),通过随机取出长度为m的子串作为模式P,在文本T中进行匹配,统计平均复杂度。对于成功和失败的匹配分别进行测试,分析其平均复杂度。详情请参考相关学习资源。 ... [详细]
  • WebSocket与Socket.io的理解
    WebSocketprotocol是HTML5一种新的协议。它的最大特点就是,服务器可以主动向客户端推送信息,客户端也可以主动向服务器发送信息,是真正的双向平等对话,属于服务器推送 ... [详细]
author-avatar
KisS汐唲
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有