當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。