当前位置: 首页>>代码示例>>Java>>正文


Java ChannelStateEvent类代码示例

本文整理汇总了Java中org.jboss.netty.channel.ChannelStateEvent的典型用法代码示例。如果您正苦于以下问题:Java ChannelStateEvent类的具体用法?Java ChannelStateEvent怎么用?Java ChannelStateEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ChannelStateEvent类属于org.jboss.netty.channel包,在下文中一共展示了ChannelStateEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: channelConnected

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:22,代码来源:NettyServerCnxnFactory.java

示例2: channelDisconnected

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:OspfInterfaceChannelHandler.java

示例3: channelDisconnected

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:PcepChannelHandler.java

示例4: channelDisconnected

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@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());
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:17,代码来源:OFChannelHandler.java

示例5: channelConnected

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:sereca,项目名称:SecureKeeper,代码行数:24,代码来源:NettyServerCnxnFactory.java

示例6: channelOpen

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
		throws Exception {
	if (null != channelGroups) {
		channelGroups.add(e.getChannel());
	}
}
 
开发者ID:zhaoshiling1017,项目名称:voyage,代码行数:8,代码来源:NettyRpcServerHandler.java

示例7: channelConnected

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:13,代码来源:NettyHandler.java

示例8: channelDisconnected

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:11,代码来源:NettyHandler.java

示例9: channelClosed

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
    throws Exception
{
    if (LOG.isTraceEnabled()) {
        LOG.trace("Channel closed " + e);
    }
    allChannels.remove(ctx.getChannel());
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:10,代码来源:NettyServerCnxnFactory.java

示例10: channelConnected

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:14,代码来源:NettyServerCnxnFactory.java

示例11: channelDisconnected

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:16,代码来源:NettyServerCnxnFactory.java

示例12: channelConnected

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:qizhenghao,项目名称:HiBangClient,代码行数:8,代码来源:ClientHandler.java

示例13: channelDisconnected

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:12,代码来源:MainEventHandler.java

示例14: channelOpen

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@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);
 
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:ShuffleHandler.java

示例15: channelConnected

import org.jboss.netty.channel.ChannelStateEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:SimpleTcpClientHandler.java


注:本文中的org.jboss.netty.channel.ChannelStateEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。