Example usage for io.netty.channel ChannelHandlerContext fireChannelRegistered

List of usage examples for io.netty.channel ChannelHandlerContext fireChannelRegistered

Introduction

In this page you can find the example usage for io.netty.channel ChannelHandlerContext fireChannelRegistered.

Prototype

@Override
    ChannelHandlerContext fireChannelRegistered();

Source Link

Usage

From source file:com.alibaba.dubbo.remoting.transport.netty4.NettyHandler.java

License:Apache License

@Override
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
    ctx.fireChannelRegistered();
}

From source file:com.farsunset.cim.sdk.android.filter.CIMLoggingHandler.java

License:Apache License

@Override
public void channelRegistered(ChannelHandlerContext ctx) {
    ctx.fireChannelRegistered();
}

From source file:com.github.lburgazzoli.quickfixj.transport.netty.NettyChannelHandler.java

License:Apache License

@Override
public void channelRegistered(ChannelHandlerContext ctx) {
    ctx.attr(ATTR_SESSION_TYPE).set(m_sessionType);
    ctx.fireChannelRegistered();
}

From source file:com.github.nettybook.ch0.LoggingHandler.java

License:Apache License

@Override
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
    if (logger.isEnabled(internalLevel)) {
        logger.log(internalLevel, format(ctx, "REGISTERED"));
    }//  ww  w.  j  a  v a2 s .c  om
    ctx.fireChannelRegistered();
}

From source file:com.hazelcast.openshift.TunnelServerConnector.java

License:Open Source License

@Override
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
    Promise promise = new Promise();
    Bootstrap bootstrap = createBootstrap(ctx.channel(), promise);
    ChannelFuture future = bootstrap.connect(httpHost, httpPort);
    Channel forward = future.sync().channel();
    forward.closeFuture().addListener(f -> ctx.close());
    ctx.channel().closeFuture().addListener(f -> forward.close());

    HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.CONNECT, "/");
    request.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
    forward.writeAndFlush(request);/*from  ww  w  . j  ava  2  s . c o m*/

    // Wait for the initial http response (ssl established)
    promise.sync(10, TimeUnit.SECONDS);

    // Exchange the HazelcastClient -> TunnelClient handler to proxy
    ChannelPipeline pipeline = ctx.pipeline();
    pipeline.addLast(new ProxyForwardHandler(forward));
    pipeline.remove(this);

    ctx.fireChannelRegistered();
}

From source file:com.weibo.api.motan.transport.netty4.NettyServerChannelManage.java

License:Apache License

@Override
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
    Channel channel = ctx.channel();
    String channelKey = getChannelKey((InetSocketAddress) channel.localAddress(),
            (InetSocketAddress) channel.remoteAddress());
    if (channels.size() >= maxChannel) {
        // ?close
        LoggerUtil.warn(/*from www. j  a v a  2  s  .c  om*/
                "NettyServerChannelManage channelConnected channel size out of limit: limit={} current={}",
                maxChannel, channels.size());
        channel.close();
    } else {
        channels.put(channelKey, channel);
        ctx.fireChannelRegistered();
    }
}

From source file:com.weibo.api.motan.transport.netty4.server.Netty4ServerChannelManage.java

License:Apache License

@Override
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
    Channel channel = ctx.channel();

    String channelKey = getChannelKey((InetSocketAddress) channel.localAddress(),
            (InetSocketAddress) channel.remoteAddress());

    if (channels.size() > maxChannel) {
        // ?close
        LoggerUtil.warn(/*from  w  w w  . j ava2s.  c  om*/
                "Netty4ServerChannelManage channelConnected channel size out of limit: limit={} current={}",
                maxChannel, channels.size());

        channel.close();
    } else {
        channels.put(channelKey, channel);
        ctx.fireChannelRegistered();
    }
}

From source file:com.witjit.game.server.communication.netty.handler.NodeChannelInitializer.java

@Override
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
    sendNodeInformation(ctx.channel());/*  ww  w .  ja  v  a 2 s. c om*/
    ctx.fireChannelRegistered();
}

From source file:dorkbox.network.connection.registration.RegistrationHandler.java

License:Apache License

@Override
public final void channelRegistered(final ChannelHandlerContext context) throws Exception {
    boolean success = false;
    try {// w  ww .  j a v  a  2s . c  o  m
        initChannel(context.channel());
        context.fireChannelRegistered();
        success = true;
    } catch (Throwable t) {
        this.logger.error("Failed to initialize a channel. Closing: {}", context.channel(), t);
    } finally {
        if (!success) {
            context.close();
        }
    }
}

From source file:io.lettuce.core.protocol.CommandHandler.java

License:Apache License

/**
 * @see io.netty.channel.ChannelInboundHandlerAdapter#channelRegistered(io.netty.channel.ChannelHandlerContext)
 *///w  ww . j a  va  2  s  .  c  o m
@Override
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {

    if (isClosed()) {
        logger.debug("{} Dropping register for a closed channel", logPrefix());
    }

    channel = ctx.channel();

    if (debugEnabled) {
        logPrefix = null;
        logger.debug("{} channelRegistered()", logPrefix());
    }

    setState(LifecycleState.REGISTERED);

    buffer = ctx.alloc().directBuffer(8192 * 8);
    ctx.fireChannelRegistered();
}