• 一个非常简单的线程池

    public final class ThreadExecutor { public static final ExecutorService EXECUTOR_SERVICE = new ThreadPoolExecutor(10, 100, 3, TimeUnit.M...

    @Autowired可以作用在方法上,避免有时出现的注入失败

    @Slf4j@Component@ChannelHandler.Sharablepublic class NettyWsHandler extends SimpleChannelInboundHandler<TextWebSocketFrame> { private static ...

    netty给channel添加标识,以便后续直接从channel中获取

    添加:AttributeKey<String> key = AttributeKey.valueOf("sn");ctx.channel().attr(key).set(deviceSn);获取:AttributeKey<String> key = Att...

    springboot项目中获取tomcat启动端口

    @Component@Slf4jpublic class ServerConfig implements ApplicationListener<WebServerInitializedEvent> { private int serverPort; public int g...