原创 Kafka客户端向缓冲区写入消息的流程
会阻塞一段时间,maxBlockMs - 可能获取元数据耗费的时间,如果还是不行的话,就会抛异常了,但是这段时间里有可用内存腾出来了(有一些batch被发送出去了,获取到了响应,此时就可以释放那个batch底层对应的ByteBuffer,就会被放回到BufferPool里面去,此时就可以唤醒阻塞的线程,再次申请一个新的ByteBuffer构造一个Batch)(2)如果wait(60s)一直超时了,你的Sender线程都没加载成功元数据,此时人家在60s后自动醒来了,此时会直接超时抛异常。
2024-04-13 13:44:14
657
2
原创 KafKa生产端在初始化的时候都做了什么
不会,不会去broker上去拉取元数据的,而是等到实际用的时候没有元数据再去拉取吗,但是也是对元数据做了一些初始化的,将配置中的broker地址转化为Node,放置在了Cluster的对象实例中。系统通过KafKaProducer去发送消息,其中KafkaProducer包括一些核心的资源,例如线程资源,网络资源等等。同时会将调用sender.run作为守护线程,用于不停的从缓冲区中读取数据,并发送。
2024-04-13 11:03:03
288
原创 数论初级
数论(初级) 目录 GCD、LCM 扩展GCD 素数 快速幂 快速乘法取模 逆元 费马小定理&&欧拉定理 线性递推求逆元 欧拉函数 1.GCD、LCM//GCD(最大公约数)模板 void GCD(int a,int b) { return b==0?a:gcd(b,a%b); } //LCM(最小公倍数)模板 void LCM(int a,int b) { ret
2017-08-01 23:12:33
523
原创 ACM 水题进制转换
进制转换 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 49067 Accepted Submission(s): 26945 Problem Description 输入一个十进制数N,将它转换成R进制数输出。
2017-04-27 12:29:03
400
转载 ACM 水题
Problem Description There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal
2017-04-27 11:54:35
764
原创 ACM 水题
Let the Balloon Rise Problem Description Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular probl
2017-04-27 11:36:07
953
原创 ACM 第一天水题 (4)
Problem: You are my brother Problem Description Little A gets to know a new friend, Little B, recently. One day, they realize that they are family 500 years ago. Now, Little A wants to know wh
2017-04-21 20:55:19
488
1
原创 ACM 第一天水题(3)
Problem: Dinner——水 Problem Description Little A is one member of ACM team. He had just won the gold in World Final. To celebrate, he decided to invite all to have one meal. As bowl, knife and ot
2017-04-21 20:11:29
468
原创 ACM 第一天水题 (2)
Problem: Clock Problem Description In order to get the run time of a user function,you can use the clock() function in time.h.Clock() use clock tick to measure time,which will increase CLK_TCK p
2017-04-21 19:51:03
329
原创 ACM 第一天水题
Problem: Conversion Problem Description Let us use ‘B’ to denote “bai” in chinese,and ‘S’ to denote “shi” in chinese,and ‘123..n’ to denote the least significant number,then we can use them to c
2017-04-21 19:29:23
590
RSS订阅