自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(156)
  • 资源 (2)
  • 收藏
  • 关注

原创 PooledByteBuf分配及回收之十六AdaptiveRecvByteBufAllocator源码解析

AdaptiveRecvByteBufAllocator 决定了要分配的ByteBuf的容量。RecvByteBufAllocatorpublic interface RecvByteBufAllocator { //创建一个新的句柄。句柄提供实际操作并保留内部信息,这是预测最佳缓冲区容量所必需的。 Handle newHandle(); @Deprecated interface Handle { //创建一个新的接

2021-02-20 16:26:43 337

原创 PooledByteBuf分配及回收之十五PooledByteBuf的回收

父类AbstractReferenceCountedByteBuf初始化属性 static final long REFCNT_FIELD_OFFSET ReferenceCountUpdater.getUnsafeOffset(AbstractReferenceCountedByteBuf.class, "refCnt") AbstractReferenceCountedByteBuf类refCnt属性的偏移量 stat..

2021-02-03 11:26:56 464

原创 PooledByteBuf分配及回收之十PoolChunkList源码解析

属性属性 含义 值 static final Iterator<PoolChunkMetric> EMPTY_METRICS 一个空的Iterator Collections.<PoolChunkMetric>emptyList().iterator() final PoolArena<T> arena PoolChunkList所属的PoolArena fi..

2021-02-03 09:55:21 235

原创 PooledByteBuf分配及回收之十四Recycler.Stack<T> 弹出对象

弹出对象 DefaultHandle<T> pop() { int size = this.size; //先判断size是否==0 if (size == 0) { //从WeakOrderQueue中扫出对象放入elements数组中 if (!scavenge()) { return null

2021-01-29 09:46:01 169

原创 PooledByteBuf分配及回收之十三Recycler.Stack<T> 压入对象

压入对象 void push(DefaultHandle<?> item) { Thread currentThread = Thread.currentThread(); if (threadRef.get() == currentThread) { // The current Thread is the thread that belongs to the Stack, we can tr

2021-01-29 09:09:08 184

原创 PooledByteBuf分配及回收之十二Recycler及基内部类初始化

Recycler属性属性 值 含义 static final Handle NOOP_HANDLE new Handle() { @Override public void recycle(Object object) { // NOOP }} static final AtomicInteger ID_GENERATOR new A..

2021-01-28 10:34:17 200

原创 PooledByteBuf分配及回收之十一ReferenceCountUpdater源码解析

对于更新的int字段:偶数=>“实际”引用计数为(refCnt >>> 1) 奇数=>“真实”引用计数为0(x&y)似乎相对于(x == y)昂贵。因此,此类在检查实时(偶数)引用计数时,在某些地方使用快速路径获取最常见的低值,例如:if (rawCnt == 2 || rawCnt == 4 || (rawCnt & 1) == 0) { ...构造方法与抽象方法protected ReferenceCountUpdater()...

2021-01-26 17:37:49 399 1

原创 PooledByteBuf分配及回收之一PooledByteBufAllocator初始化

接口ByteBufAllocator中定义了一个默认的ByteBufAllocator DEFAULT =ByteBufUtil.DEFAULT_ALLOCATOR,跟进去:​static final ByteBufAllocator DEFAULT_ALLOCATOR;static { //非安卓返回pooled String allocType = SystemPropertyUtil.get( "io.netty.allocator.type", ...

2021-01-24 12:10:48 1037

原创 PooledByteBuf分配及回收之二PoolThreadCache初始化

构造方法PoolThreadCache(PoolArena<byte[]> heapArena, PoolArena<ByteBuffer> directArena, int tinyCacheSize, int smallCacheSize, int normalCacheSize, int maxCachedBufferCapacity, int freeSweepAllocationThres

2021-01-24 12:10:32 246

原创 PooledByteBuf分配及回收之六PooledUnsafeDirectByteBuf初始化

final class PooledUnsafeDirectByteBuf extends PooledByteBuf<ByteBuffer>PooledByteBuf的属性属性 含义 值 private final Handle<PooledByteBuf<T>> recyclerHandle 回收处理句柄 这里的T是ByteBuffer protected...

2021-01-24 12:10:03 6027 2

原创 PooledByteBuf分配及回收之三PoolAerna初始化

属性含义及初始值 属性 含义 值 static final boolean HAS_UNSAFE 是否有UNSAFE PlatformDependent.hasUnsafe() static final int numTinySubpagePools 微小子页池中页的数量 512 >>> 4 也就是32 final PooledByteBufAllocator p.

2021-01-24 12:09:50 255

原创 PooledByteBuf分配及回收之四PoolChunk初始化

属性属性 含义 值 private static final int INTEGER_SIZE_MINUS_ONE 32-1 Integer.SIZE - 1 = 31 final PoolArena<T> arena 所属的区域 final T memory 申请的内存,根据HAS_UNSAFE的结果可分为ByteBuffer和byte[] ...

2021-01-24 12:09:33 262

原创 PooledByteBuf分配及回收之五PoolSubpage初始化

属性属性 含义 值 final PoolChunk<T> chunk 所属chunk private final int memoryMapIdx 在chunk的memoryMap数组中的下标 通过下标能确认在memoryMap这个堆的哪个节点 private final int runOffset 相对于chunk offset的偏移量 标明...

2021-01-24 12:09:13 186

原创 PooledByteBuf分配及回收之八分配小型PooledByteBuf(未命中缓存场景)

先看上一篇分配微小型PooledByteBuf(未命中缓存场景)小型Capacity 大于等于512 并且小于 8192(pageSize) ~(8192 - 1) == -8192小型与微小型的差别在于获取PoolSubpage的不同,小型是从PoolArena的smallSubpagePools数组中获取smallSubpagePools数组长度为4private void allocate(PoolThreadCache cache, PooledByteBuf&lt...

2021-01-24 12:08:56 182

原创 PooledByteBuf分配及回收之九分配普通型PooledByteBuf(未命中缓存场景)

先看分配微小型PooledByteBuf(未命中缓存场景)PoolArena的allocate(PoolThreadCache cache, PooledByteBuf<T> buf, final int reqCapacity)方法 private void allocate(PoolThreadCache cache, PooledByteBuf<T> buf, final int reqCapacity) { final int normCa.

2021-01-24 12:08:24 196

原创 PooledByteBuf分配及回收之七分配微小型PooledByteBuf(未命中缓存场景)

微小型Capacity 小于512 Capacity & -512 == 0 代表微小型小型Capacity 大于512 并且小于 8192(pageSize) ~(8192 - 1) == -8192 Capacity & -8192 == 0 代表小型PooledByteBufAllocator的newDirectBuffer方法 @Override protected ByteBuf newDirectBuffer(int init...

2021-01-24 12:07:46 342

转载 自定义BeanDefinitionRegistryPostProcessor

转自:https://blog.csdn.net/liyantianmin/article/details/81047373

2019-07-15 16:11:12 233

转载 class.forname和classloader区别

转自:https://blog.csdn.net/m0_37284598/article/details/82950779Java中class是如何加载到JVM中的:1.class加载到JVM中有三个步骤 装载:(loading)找到class对应的字节码文件。 连接:(linking)将对应的字节码文件读入到JVM中。初始化:(initializing)对clas...

2019-07-12 09:33:58 248

转载 关于spring中的BeanDefinitionRegistryPostProcessor和ImportBeanDefinitionRegistrar接口

转自:https://blog.csdn.net/lichuangcsdn/article/details/89930945这两个接口都可以用于动态注册bean到容器中。BeanDefinitionRegistryPostProcessor实现了BeanFactoryPostProcessor接口,是Spring框架的BeanDefinitionRegistry的后处理器,用来注册额外的B...

2019-07-09 15:16:13 677

原创 EMQTT(EMQX) SSL/TLS单向认证及JAVA代码

采用部署架构安装NGINX安装EMQX引入JAR<dependency> <groupId>org.eclipse.paho</groupId> <artifactId>org.eclipse.paho.client.mqttv3</artifactId> <version>1.2...

2019-07-08 15:28:40 3216 1

原创 Docker-compose构建emqx

创建docker-compose.ymlversion: '3'services: emqx: image: emqx/emqx container_name: emqx ports: - "1883:1883" - "8083:8083" - "8883:8883" - "8084:8084" ...

2019-07-08 15:21:31 3655

原创 Docker-compose 构建nginx 并开启TCP SSL

证书方面请参数:自制CA证书,自制客户端,服务端证书我的证书目录为:/Users/dd/Desktop/docker/caNGINX相关:创建nginx.confuser nginx;worker_processes 1;error_log /var/log/nginx/error.log warn;pid /var/run/nginx.pid;...

2019-07-08 15:16:50 1145 1

转载 MQTT协议介绍

协议介绍 (Protocol)MQTT协议概览MQTT是一个轻量的发布订阅模式消息传输协议,专门针对低带宽和不稳定网络环境的物联网应用设计。MQTT官网:http://mqtt.orgMQTT V3.1.1协议规范:http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html特点开放消息协议,简...

2019-07-03 15:21:51 2597

转载 (转载)FactoryBean

转载自:https://blog.51cto.com/4247649/21183531,FactoryBean是什么FactoryBean从名字来看以bean结尾那应该就是一个bean吧,没错它确实是一个bean,不同于普通Bean的是:它是实现了FactoryBean<T>接口的Bean,根据该Bean的ID从BeanFactory中获取的实际上是FactoryBean...

2019-06-25 13:59:10 161

转载 (转载)深入理解Spring的ImportBeanDefinitionRegistrar接口

转载处:https://www.cnblogs.com/zzq-include/p/8004506.html@Import({DataSourceRegister.class,A.class})@SpringBootApplication@ComponentScan("com.viewhigh.bi")//@EnableCachingpublic class BiApplicatio...

2019-06-25 09:21:21 766

转载 (转载)深入理解Spring的ImportSelector,DeferredImportSelector

转载自:https://www.cnblogs.com/niechen/p/9262452.html阅读目录一、关于ImportSelector接口 二、自定义@EnableXXX注解 三、ImportSelector源码分析  ImportSelector接口是至spring中导入外部配置的核心接口,在SpringBoot的自动化配置和@EnableXXX(功能性注解)都有它的存在...

2019-06-24 17:54:41 2055

原创 SpringBoot AutoConfiguration spring.factories

# Initializersorg.springframework.context.ApplicationContextInitializer=\org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer,\org.springframework.boot.autoconfigur...

2019-06-22 16:56:58 278

转载 SpringBoot spring.factories

# PropertySource Loadersorg.springframework.boot.env.PropertySourceLoader=\org.springframework.boot.env.PropertiesPropertySourceLoader,\org.springframework.boot.env.YamlPropertySourceLoader# Run...

2019-06-21 11:34:35 389

转载 访问者模式

2019-06-20 19:26:20 150

转载 职责链模式

2019-06-20 17:26:10 210

转载 装饰模式

2019-06-20 15:37:30 105

转载 状态模式

2019-06-19 11:36:26 111

转载 策略模式

2019-06-19 11:10:15 156

转载 模板方法模式

2019-06-19 10:09:32 84

转载 组合模式

2019-06-19 09:34:43 96

转载 命令模式

2019-06-15 17:08:56 104

转载 观察者模式

2019-06-13 18:09:51 100

转载 代理模式

2019-06-13 17:29:28 118

转载 中介者模式

2019-06-13 15:57:55 130

转载 单例模式

饿汉式及懒汉式均有缺陷,解决方法如下:

2019-06-11 11:19:10 193

Spket1.6破解版

Spket1.6破解版,本来想收费的,但是偶自己讨厌收费的,所以偶不收费了,同时向那些不收费的哥们儿致敬

2012-12-20

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除