Fetch the repository succeeded.
This action will force synchronization from baolinking/物联网关, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
/**
*
*/
package connect;
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import divpro.DivChannelInitializer;
import freeconfig.GetProperties;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import jedis.Jedisclusters;
/**
* @Description:
* 心跳时间,不同设备或厂家的心跳时间是不同的,按配置更改就行
* @author: wbl
* @date: 2019年8月30日 上午10:04:44
*/
@Configuration
public class ToClientDesign implements Runnable{
private int poolNum = 0;
@Resource
public static Jedisclusters jedisCluster;
public ToClientDesign(int poolnum){
this.poolNum = poolnum;
}
@Override
public void run() {
EventLoopGroup bossGroup = new NioEventLoopGroup(ConfigDesign.BIZGROUPSIZE);
EventLoopGroup workerGroup = new NioEventLoopGroup(ConfigDesign.BIZTHREADSIZE);
try {
ServerBootstrap gateServer = new ServerBootstrap();
gateServer.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.SO_BACKLOG, ConfigDesign.CACHESIZE)
.childHandler(new DivChannelInitializer());
String port = GetProperties.getValue("client.port");
System.out.println("read client config:"+port);
ChannelFuture f = gateServer.bind(Integer.parseInt(port)).sync();
System.out.println("bind: ["+new Date()+"] 服务器开始监听端口"+port+",等待客户端连接.........");
f.channel().closeFuture().sync();
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
/**优雅退出,释放线程池资源*/
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。