面接メモ

1236 ワード

Springプロパティ単例モードの実装方法
redisメモリ淘汰ポリシー
Spring beanのライフサイクルhttps://yq.aliyun.com/articles/709422
Redisの期限切れポリシーとメモリ淘汰メカニズムhttps://www.cnblogs.com/mengchunchen/p/10039467.html
@Bean注記、メソッドレベルの注記、@Configuration注記のクラスでは、@Component注記のクラスでも使用できます.追加されたbeanのidはメソッド名ですhttps://www.jianshu.com/p/06d8967b187a
https://blog.csdn.net/qq_23179075/article/details/78753136collections sort使用
@Bean
public ThreadPoolTaskExecutor asyncServiceExecutor() {
    log.info("start asyncServiceExecutor");
    
    int coreNum = Runtime.getRuntime().availableProcessors();
    log.info("the core's number of this server is "+coreNum);
    
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    //       
    executor.setCorePoolSize(coreNum/2+1);
    //       
    executor.setMaxPoolSize(coreNum+1);
    //      
    executor.setQueueCapacity(99999);
    //              
    executor.setThreadNamePrefix("async-service-");

    // rejection-policy: pool    max size   ,       
    // CALLER_RUNS:          ,              
    executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
    //     
    executor.initialize();
    return executor;
}