前言 最近写论文的时候又一次用到了R。这次我是对Java有一定程度了解后再次转向R,才真正认识到R这门语言在统计编程和数据可视化领域的优雅和快速。 首先可以看一段Java的stream代码: redisUtils.opsForHashValues(Const.COOP_PREFIX.getInfo( Read More
posted @ 2023-02-14 01:10 imissinstagram Views(62) Comments(0) Diggs(0) Edit
前言 这两天封在家里,一直在琢磨想去把这个博客项目改成微服务的形式。不过就目前而言我的服务器内存放好几个Java进程是吃不消的,原因在于一个独立的JVM所占用的内存资源太吃内存。不过在云原生时代,使用容器化部署,每个服务单独享受一整块逻辑的内存空间,实际上对Java是非常不利的。而且即便有的应用功能 Read More
posted @ 2022-11-06 16:56 imissinstagram Views(2461) Comments(0) Diggs(0) Edit
背景 有时候,在微服务时代,我们需要对全部的机器节点进行通知。在常规情况下,一个请求经过负载均衡只有一个机器可以收到。那么,如何能让全部的机器都收到同样的请求呢?需要借助消息队列的监听机制,让每个节点都监听一个队列,让消息发送到所有的队列中。 rabbit MQ的fanout交换机可以实现这种功能。 Read More
posted @ 2022-09-29 14:47 imissinstagram Views(473) Comments(0) Diggs(0) Edit
旧依赖的移除 长久以来,使用Spring Security整合oauth2,都是使用Spring Security Oauth2这个系列的包: <dependency> <groupId>org.springframework.security.oauth</groupId> <artifactId Read More
posted @ 2022-09-29 13:49 imissinstagram Views(6740) Comments(1) Diggs(0) Edit
前情提要 之前我的项目里有一个合作编辑的功能,多个客户端的用户可以合作写一篇文章的不同部分,而且合作的任意作者互相还可以进行文字通讯。这种需求肯定是首选websocket了,因为服务器需要主动给客户端推送消息,维持一个长连接是最经济实惠的手段。如果一个客户端需要给另一个客户端做推送,那肯定是需要中间 Read More
posted @ 2022-09-11 17:20 imissinstagram Views(158) Comments(0) Diggs(0) Edit
描述 这个BUG大的起源是我上线以后,在后台看日志的时候发现一行奇怪的INFO日志: 2022-06-09 23:34:24 [restartedMain] [org.springframework.context.support.PostProcessorRegistrationDelegate$ Read More
posted @ 2022-06-10 00:18 imissinstagram Views(1441) Comments(0) Diggs(0) Edit
只有真正理解了Java中对象是什么,才能理解这个关键字是什么意思 字面解释 Java Guide中如此解释: synchronized 关键字解决的是多个线程之间访问资源的同步性,synchronized关键字可以保证被它修饰的方法或者代码块在任意时刻只能有一个线程执行。 测试 但是这句话很多时候是 Read More
posted @ 2022-05-14 02:36 imissinstagram Views(246) Comments(0) Diggs(0) Edit
doService /** * Exposes the DispatcherServlet-specific request attributes and delegates to {@link #doDispatch} * for the actual dispatching. */ @Overr Read More
posted @ 2022-04-02 00:40 imissinstagram Views(23) Comments(0) Diggs(0) Edit
通过n个线程顺序打印26个英文字母,例如 n=3 则输出: thread0: a thread1: b thread2: c thread0: d 方案一:轮询 多个线程不断轮询是否是该线程执行任务。因为线程要不断轮循,所以效率较低。 答案 import java.util.*; /** * n个线 Read More
posted @ 2022-03-23 15:26 imissinstagram Views(166) Comments(0) Diggs(0) Edit
3.17阿里Java后端 字典 有英文字典:Map<Character, String[]>,示例如下: a : [a, an] b : [bus, bird] c : [car, can, card] ... z : [zone] 输入 一个a-z组成的字符串,字符串每一位表示字典的key 输出 Read More
posted @ 2022-03-21 11:56 imissinstagram Views(308) Comments(0) Diggs(0) Edit