并发
Rcfee
这个作者很懒,什么都没留下…
展开
-
netty websockt之断连重试
ChannelInboundHandlerAdapter重写channelInactive,当连接变为不活跃,则回调该方法。ChannelFutureListener监听ChannelFuture..isSuccess();1、连接异常,比如网络抖动导致连接失败;2、连接过程中断开连接重试;原创 2023-11-17 14:01:53 · 370 阅读 · 0 评论 -
netty之EventLoopGroup
重点就是最后哪个方法的注释:Returns the number of processors available to the Java virtual machine.(返回Java虚拟机可用的处理器数。创建EventLoopGroup使用无参构造方法时,发现会创建24个NioEventLoop(readonlyChildren.size=24),经查,是取的java虚拟机的可用处理器数2倍。原创 2023-11-16 17:10:22 · 100 阅读 · 0 评论 -
并发之Thread源码解读
Runnable与Thread没有根本性的区别,Runnable定位为一个功能性接口,如下:@FunctionalInterfacepublic interface Runnable { /** * When an object implementing interface <code>Runnable</code> is used * to create a thread, starting the thread causes the objec原创 2021-04-01 15:25:55 · 159 阅读 · 0 评论 -
线程之ThreadPoolExecutor
主要的成员变量: private final AtomicInteger ctl = new AtomicInteger(ctlOf(RUNNING, 0)); private static final int COUNT_BITS = Integer.SIZE - 3; private static final int CAPACITY = (1 << COUNT_BITS) - 1;ctl:保存线程池状态和线程池有效数量控制的字段,使用前Integer类型原创 2021-03-30 15:45:07 · 115 阅读 · 0 评论