java类org.jboss.netty.channel.ChannelStateEvent的实例源码

NettyServerCnxnFactory.java 文件源码 项目:https-github.com-apache-zookeeper 阅读 32 收藏 0 点赞 0 评论 0
@Override
public void channelConnected(ChannelHandlerContext ctx,
        ChannelStateEvent e) throws Exception
{
    if (LOG.isTraceEnabled()) {
        LOG.trace("Channel connected " + e);
    }

    NettyServerCnxn cnxn = new NettyServerCnxn(ctx.getChannel(),
            zkServer, NettyServerCnxnFactory.this);
    ctx.setAttachment(cnxn);

    if (secure) {
        SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class);
        ChannelFuture handshakeFuture = sslHandler.handshake();
        handshakeFuture.addListener(new CertificateVerifier(sslHandler, cnxn));
    } else {
        allChannels.add(ctx.getChannel());
        addCnxn(cnxn);
    }
}
OspfInterfaceChannelHandler.java 文件源码 项目:athena 阅读 29 收藏 0 点赞 0 评论 0
@Override
public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent evt) {
    log.debug("OspfChannelHandler::channelDisconnected...!!!");

    for (Integer interfaceIndex : ospfInterfaceMap.keySet()) {
        OspfInterface anInterface = ospfInterfaceMap.get(interfaceIndex);
        if (anInterface != null) {
            anInterface.interfaceDown();
            anInterface.stopDelayedAckTimer();
        }
    }

    if (controller != null) {
        controller.connectPeer();
    }
}
PcepChannelHandler.java 文件源码 项目:athena 阅读 31 收藏 0 点赞 0 评论 0
@Override
public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    log.info("Pcc disconnected callback for pc:{}. Cleaning up ...", getClientInfoString());
    if (thispccId != null) {
        if (!duplicatePccIdFound) {
            // if the disconnected client (on this ChannelHandler)
            // was not one with a duplicate-dpid, it is safe to remove all
            // state for it at the controller. Notice that if the disconnected
            // client was a duplicate-ip, calling the method below would clear
            // all state for the original client (with the same ip),
            // which we obviously don't want.
            log.debug("{}:removal called", getClientInfoString());
            if (pc != null) {
                pc.removeConnectedClient();
            }
        } else {
            // A duplicate was disconnected on this ChannelHandler,
            // this is the same client reconnecting, but the original state was
            // not cleaned up - XXX check liveness of original ChannelHandler
            log.debug("{}:duplicate found", getClientInfoString());
            duplicatePccIdFound = Boolean.FALSE;
        }
    } else {
        log.warn("no pccip in channelHandler registered for " + "disconnected client {}", getClientInfoString());
    }
}
OFChannelHandler.java 文件源码 项目:QoS-floodlight 阅读 30 收藏 0 点赞 0 评论 0
@Override
@LogMessageDoc(message="Disconnected switch {switch information}",
               explanation="The specified switch has disconnected.")
public void channelDisconnected(ChannelHandlerContext ctx,
                                ChannelStateEvent e) throws Exception {
    controller.removeSwitchChannel(this);
    if (this.sw != null) {
        // TODO: switchDisconnected() will check if we've previously
        // activated the switch. Nevertheless, we might want to check
        // here as well.
        controller.switchDisconnected(this.sw);
        this.sw.setConnected(false);
    }

    log.info("Disconnected switch {}", getSwitchInfoString());
}
NettyServerCnxnFactory.java 文件源码 项目:SecureKeeper 阅读 31 收藏 0 点赞 0 评论 0
@Override
public void channelConnected(ChannelHandlerContext ctx,
        ChannelStateEvent e) throws Exception
{
    if (LOG.isTraceEnabled()) {
        LOG.trace("Channel connected " + e);
    }

    NettyServerCnxn cnxn = new NettyServerCnxn(ctx.getChannel(),
            zkServer, NettyServerCnxnFactory.this);
    ctx.setAttachment(cnxn);

    //SECUREKEEPER: Enable ssl only if specified
    //if (secure) {
    if(encryption.equals("ssl")){
        SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class);
        ChannelFuture handshakeFuture = sslHandler.handshake();
        handshakeFuture.addListener(new CertificateVerifier(sslHandler, cnxn));
    } else {
        allChannels.add(ctx.getChannel());
        addCnxn(cnxn);
    }
}
NettyServerCnxnFactory.java 文件源码 项目:SecureKeeper 阅读 39 收藏 0 点赞 0 评论 0
@Override
public void channelConnected(ChannelHandlerContext ctx,
        ChannelStateEvent e) throws Exception
{
    if (LOG.isTraceEnabled()) {
        LOG.trace("Channel connected " + e);
    }

    NettyServerCnxn cnxn = new NettyServerCnxn(ctx.getChannel(),
            zkServer, NettyServerCnxnFactory.this);
    ctx.setAttachment(cnxn);

    //SECUREKEEPER: Enable ssl only if specified
    //if (secure) {
    if(encryption.equals("ssl")){
        SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class);
        ChannelFuture handshakeFuture = sslHandler.handshake();
        handshakeFuture.addListener(new CertificateVerifier(sslHandler, cnxn));
    } else {
        allChannels.add(ctx.getChannel());
        addCnxn(cnxn);
    }
}
NettyRpcServerHandler.java 文件源码 项目:voyage 阅读 28 收藏 0 点赞 0 评论 0
@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
        throws Exception {
    if (null != channelGroups) {
        channelGroups.add(e.getChannel());
    }
}
NettyHandler.java 文件源码 项目:EatDubbo 阅读 32 收藏 0 点赞 0 评论 0
@Override
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    NettyChannel channel = NettyChannel.getOrAddChannel(ctx.getChannel(), url, handler);
    try {
        if (channel != null) {
            channels.put(NetUtils.toAddressString((InetSocketAddress) ctx.getChannel().getRemoteAddress()), channel);
        }
        handler.connected(channel);
    } finally {
        NettyChannel.removeChannelIfDisconnected(ctx.getChannel());
    }
}
NettyHandler.java 文件源码 项目:EatDubbo 阅读 33 收藏 0 点赞 0 评论 0
@Override
public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    NettyChannel channel = NettyChannel.getOrAddChannel(ctx.getChannel(), url, handler);
    try {
        channels.remove(NetUtils.toAddressString((InetSocketAddress) ctx.getChannel().getRemoteAddress()));
        handler.disconnected(channel);
    } finally {
        NettyChannel.removeChannelIfDisconnected(ctx.getChannel());
    }
}
NettyServerCnxnFactory.java 文件源码 项目:fuck_zookeeper 阅读 32 收藏 0 点赞 0 评论 0
@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
    throws Exception
{
    if (LOG.isTraceEnabled()) {
        LOG.trace("Channel closed " + e);
    }
    allChannels.remove(ctx.getChannel());
}
NettyServerCnxnFactory.java 文件源码 项目:fuck_zookeeper 阅读 27 收藏 0 点赞 0 评论 0
@Override
public void channelConnected(ChannelHandlerContext ctx,
        ChannelStateEvent e) throws Exception
{
    if (LOG.isTraceEnabled()) {
        LOG.trace("Channel connected " + e);
    }
    allChannels.add(ctx.getChannel());
    NettyServerCnxn cnxn = new NettyServerCnxn(ctx.getChannel(),
            zkServer, NettyServerCnxnFactory.this);
    ctx.setAttachment(cnxn);
    addCnxn(cnxn);
}
NettyServerCnxnFactory.java 文件源码 项目:fuck_zookeeper 阅读 35 收藏 0 点赞 0 评论 0
@Override
public void channelDisconnected(ChannelHandlerContext ctx,
        ChannelStateEvent e) throws Exception
{
    if (LOG.isTraceEnabled()) {
        LOG.trace("Channel disconnected " + e);
    }
    NettyServerCnxn cnxn = (NettyServerCnxn) ctx.getAttachment();
    if (cnxn != null) {
        if (LOG.isTraceEnabled()) {
            LOG.trace("Channel disconnect caused close " + e);
        }
        cnxn.close();
    }
}
NettyHandler.java 文件源码 项目:dubbo2 阅读 67 收藏 0 点赞 0 评论 0
@Override
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    NettyChannel channel = NettyChannel.getOrAddChannel(ctx.getChannel(), url, handler);
    try {
        if (channel != null) {
            channels.put(NetUtils.toAddressString((InetSocketAddress) ctx.getChannel().getRemoteAddress()), channel);
        }
        handler.connected(channel);
    } finally {
        NettyChannel.removeChannelIfDisconnected(ctx.getChannel());
    }
}
NettyHandler.java 文件源码 项目:dubbo2 阅读 27 收藏 0 点赞 0 评论 0
@Override
public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    NettyChannel channel = NettyChannel.getOrAddChannel(ctx.getChannel(), url, handler);
    try {
        channels.remove(NetUtils.toAddressString((InetSocketAddress) ctx.getChannel().getRemoteAddress()));
        handler.disconnected(channel);
    } finally {
        NettyChannel.removeChannelIfDisconnected(ctx.getChannel());
    }
}
ClientHandler.java 文件源码 项目:HiBangClient 阅读 47 收藏 0 点赞 0 评论 0
@Override
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e)
        throws Exception {
    MyToast.ShowMessage(SMsgManage.getManager().getCurrContext(), e.toString());
    Log.i(ClientHandler.class.getName(), e.toString());
    super.channelConnected(ctx, e);
}
NettyServerCnxnFactory.java 文件源码 项目:https-github.com-apache-zookeeper 阅读 30 收藏 0 点赞 0 评论 0
@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
    throws Exception
{
    if (LOG.isTraceEnabled()) {
        LOG.trace("Channel closed " + e);
    }
    allChannels.remove(ctx.getChannel());
}
NettyServerCnxnFactory.java 文件源码 项目:https-github.com-apache-zookeeper 阅读 40 收藏 0 点赞 0 评论 0
@Override
public void channelDisconnected(ChannelHandlerContext ctx,
        ChannelStateEvent e) throws Exception
{
    if (LOG.isTraceEnabled()) {
        LOG.trace("Channel disconnected " + e);
    }
    NettyServerCnxn cnxn = (NettyServerCnxn) ctx.getAttachment();
    if (cnxn != null) {
        if (LOG.isTraceEnabled()) {
            LOG.trace("Channel disconnect caused close " + e);
        }
        cnxn.close();
    }
}
MainEventHandler.java 文件源码 项目:traccar-service 阅读 29 收藏 0 点赞 0 评论 0
@Override
public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) {
    Log.info(formatChannel(e.getChannel()) + " disconnected");
    closeChannel(e.getChannel());

    BaseProtocolDecoder protocolDecoder = (BaseProtocolDecoder) ctx.getPipeline().get("objectDecoder");
    if (ctx.getPipeline().get("httpDecoder") == null
            && !connectionlessProtocols.contains(protocolDecoder.getProtocolName())) {
        Context.getConnectionManager().removeActiveDevice(e.getChannel());
    }
}
NettyHandler.java 文件源码 项目:dubbox-hystrix 阅读 45 收藏 0 点赞 0 评论 0
@Override
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    NettyChannel channel = NettyChannel.getOrAddChannel(ctx.getChannel(), url, handler);
    try {
        if (channel != null) {
            channels.put(NetUtils.toAddressString((InetSocketAddress) ctx.getChannel().getRemoteAddress()), channel);
        }
        handler.connected(channel);
    } finally {
        NettyChannel.removeChannelIfDisconnected(ctx.getChannel());
    }
}
NettyHandler.java 文件源码 项目:dubbox-hystrix 阅读 42 收藏 0 点赞 0 评论 0
@Override
public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    NettyChannel channel = NettyChannel.getOrAddChannel(ctx.getChannel(), url, handler);
    try {
        channels.remove(NetUtils.toAddressString((InetSocketAddress) ctx.getChannel().getRemoteAddress()));
        handler.disconnected(channel);
    } finally {
        NettyChannel.removeChannelIfDisconnected(ctx.getChannel());
    }
}
ShuffleHandler.java 文件源码 项目:hadoop 阅读 29 收藏 0 点赞 0 评论 0
@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);

}
SimpleTcpClientHandler.java 文件源码 项目:hadoop 阅读 32 收藏 0 点赞 0 评论 0
@Override
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) {
  // Send the request
  if (LOG.isDebugEnabled()) {
    LOG.debug("sending PRC request");
  }
  ChannelBuffer outBuf = XDR.writeMessageTcp(request, true);
  e.getChannel().write(outBuf);
}
OspfInterfaceChannelHandlerTest.java 文件源码 项目:athena 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Tests channelConnected() method.
 */
@Test(expected = Exception.class)
public void testChannelConnected() throws Exception {
    channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
    channelStateEvent = EasyMock.createMock(ChannelStateEvent.class);
    ospfInterfaceChannelHandler.channelConnected(channelHandlerContext, channelStateEvent);
}
OspfInterfaceChannelHandlerTest.java 文件源码 项目:athena 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Tests channelDisconnected() method.
 */
@Test
public void testChannelDisconnected() throws Exception {
    channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
    channelStateEvent = EasyMock.createMock(ChannelStateEvent.class);
    ospfInterfaceChannelHandler.channelDisconnected(channelHandlerContext, channelStateEvent);
    assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
}
HandshakeTimeoutHandler.java 文件源码 项目:athena 阅读 30 收藏 0 点赞 0 评论 0
@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
        throws Exception {
    if (timeoutNanos > 0) {
        timeout = timer.newTimeout(new HandshakeTimeoutTask(ctx),
                                   timeoutNanos, TimeUnit.NANOSECONDS);
    }
    ctx.sendUpstream(e);
}
HandshakeTimeoutHandler.java 文件源码 项目:athena 阅读 30 收藏 0 点赞 0 评论 0
@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
        throws Exception {
    if (timeout != null) {
        timeout.cancel();
        timeout = null;
    }
}
OFChannelHandler.java 文件源码 项目:athena 阅读 38 收藏 0 点赞 0 评论 0
@Override
public void channelConnected(ChannelHandlerContext ctx,
        ChannelStateEvent e) throws Exception {
    channel = e.getChannel();
    log.info("New switch connection from {}",
            channel.getRemoteAddress());
    /*
        hack to wait for the switch to tell us what it's
        max version is. This is not spec compliant and should
        be removed as soon as switches behave better.
     */
    //sendHandshakeHelloMessage();
    setState(ChannelState.WAIT_HELLO);
}
OFChannelHandler.java 文件源码 项目:athena 阅读 32 收藏 0 点赞 0 评论 0
@Override
public void channelDisconnected(ChannelHandlerContext ctx,
        ChannelStateEvent e) throws Exception {
    log.info("Switch disconnected callback for sw:{}. Cleaning up ...",
            getSwitchInfoString());
    if (thisdpid != 0) {
        if (!duplicateDpidFound) {
            // if the disconnected switch (on this ChannelHandler)
            // was not one with a duplicate-dpid, it is safe to remove all
            // state for it at the controller. Notice that if the disconnected
            // switch was a duplicate-dpid, calling the method below would clear
            // all state for the original switch (with the same dpid),
            // which we obviously don't want.
            log.info("{}:removal called", getSwitchInfoString());
            if (sw != null) {
                sw.removeConnectedSwitch();
            }
        } else {
            // A duplicate was disconnected on this ChannelHandler,
            // this is the same switch reconnecting, but the original state was
            // not cleaned up - XXX check liveness of original ChannelHandler
            log.info("{}:duplicate found", getSwitchInfoString());
            duplicateDpidFound = Boolean.FALSE;
        }
    } else {
        log.warn("no dpid in channelHandler registered for "
                + "disconnected switch {}", getSwitchInfoString());
    }
}
PcepChannelHandler.java 文件源码 项目:athena 阅读 33 收藏 0 点赞 0 评论 0
@Override
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    channel = e.getChannel();
    log.info("PCC connected from {}", channel.getRemoteAddress());

    // Wait for open message from pcc client
    setState(ChannelState.OPENWAIT);
}
IsisChannelHandler.java 文件源码 项目:athena 阅读 31 收藏 0 点赞 0 评论 0
@Override
public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent evt) {
    log.debug("IsisChannelHandler::channelDisconnected...!!!");
    if (controller != null) {
        controller.connectPeer();
        stopHelloSender();
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号