本文整理汇总了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);
}
}
示例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();
}
}
示例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());
}
}
示例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());
}
示例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);
}
}
示例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());
}
}
示例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());
}
}
示例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());
}
}
示例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());
}
示例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);
}
示例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();
}
}
示例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);
}
示例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());
}
}
示例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);
}
示例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);
}