Giter Club home page Giter Club logo

javareplay's Introduction

Java复盘计划

搞 Java 也有一段时间了,不满于停留在表层,让更多的知识填满我吧!!

用来替代混乱不堪的 java_learn 仓库

计划:

  • 深入 JDK
  • 深入 JUC
  • 深入 JVM
  • 深入 Spring
  • 了解常见算法题
  • 了解常用类库

更新随缘,用到看到后再补充;

要写详细注释,要写详细注释,要写详细注释。

模块计划:

  • Algorithm: 算法相关
  • JavaBasic: JDK、JUC 等知识补充及 demo
  • DiveInSpring: 对标小马哥的SpringBoot编程**,深入理解 Spring
  • UseLibraries: 一些用的类库的基本使用

javareplay's People

Contributors

bfchengnuo avatar dependabot[bot] avatar

Stargazers

lijunwei avatar

Watchers

 avatar

javareplay's Issues

SpringBoot中使用@Async等待问题

临时解决:

    @Bean
    public AsyncTaskExecutor taskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setThreadNamePrefix("Anno-Executor");
        executor.setMaxPoolSize(10);

        // 设置拒绝策略
        executor.setRejectedExecutionHandler((r, executor1) -> {
            // .....
        });
        // 使用预定义的异常处理类
        // executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());

        return executor;
    }

see https://www.cnblogs.com/hsug/p/13303018.html

SB使用SSE

非 WebFlex 环境下使用 SSE;

与 WS 的区别,一个双向通信,一个单向通行,
前端使用上也不太一样。

#4

时区转换相关GMT

根据 GMT 来转换时间的示例:
其中使用了 Hutool 提供的工具来做了个 LocalDateTime 转 Date;

String timeZone = "GMT+8";
final ZoneId zoneId = TimeZone.getTimeZone(timeZone).toZoneId();

LocalDateTime localDateTime = LocalDateTime.now(zoneId);
localDateTime = LocalDateTimeUtil.offset(localDateTime, JobScheduleHelper.PRE_READ_MS, ChronoUnit.MILLIS);

Instant localDateTime2Instant = localDateTime.atZone(ZoneId.systemDefault()).toInstant();
Date d = Date.from(localDateTime2Instant);

Spring中Redis的事件通知

参考文档:http://redisdoc.com/topic/notification.html

键空间通知,所有通知以 keyspace@ 为前缀
键事件通知,所有通知以 keyevent@ 为前缀
例如:"__keyevent@<db>__:set" ,@ 后面是数据库序号,或者用 *

所有命令都只在键真的被改动了之后,才会产生通知,比如删除 foo 会产生键空间通知
“pmessage”,"__ key*__ : * “,”__ keyspace@0__:foo",“set”
以及键事件通知
“pmessage”,"__ key*__ : *","__ keyevent@0__:set",“foo”

如果要监听某个 key 的执行了什么操作,就订阅 keyspace@
监听某种操作动了哪些 key,就订阅 keyevent@

https://www.jianshu.com/p/70ff11f745ac

SpringBoot中使用Redis事件通知CONFIG权限问题

例如使用 AWS 的 redis 服务,会导致 springboot ERR unknown command CONFIG

解决:
KeyExpirationEventMessageListener 或者 KeyspaceEventMessageListener 的构造方法中,重置配置为空:
setKeyspaceNotificationsConfigParameter("");

KeyspaceEventMessageListener 类中有个私有变量 keyspaceNotificationsConfigParameter = "EA",在init()方法中,我们可以看到如果判断到该变量不为空,则会获取redis的配置,之后修改redis的配置,也就是只要我们把这个变量设置为空,那么springboot 初始化实例的时候也就不会去操作redis的CONFIG了,恰好,该类提供了setKeyspaceNotificationsConfigParameter()供我们修改变量的值。

因此,我们可以在自己写的Key监听器的构造方法中把keyspaceNotificationsConfigParameter 设置为空即可解决此问题

#3

see:https://blog.csdn.net/zsxlbr1314/article/details/116650952

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.