03 2021 档案
摘要:1.异步转同步,线程池提交任务,阻塞获取结果 ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) ThreadUtils.newDaemonFixedThreadExecutor("PodActionService" , Runt
阅读全文
摘要:1.把依赖打进sigma-api的jar包 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLS
阅读全文
摘要:优雅的sprongboot启动类 package fama.cost.server; import fama.cost.common.IStoppable; import fama.cost.common.thread.Stopper; import fama.cost.dao.utils.Bean
阅读全文
摘要:1.application.properties zookeeper.address=@mvn.zookeeper.address@ zookeeper.namespace=@mvn.zookeeper.namespace@ 2.pom.xml中多profile环境不同变量定义 <propertie
阅读全文
摘要:1.生成zk客户端对象 private CuratorFramework buildClient() { logger.info("zookeeper registry center init, server lists is: {}.", zookeeperConfig.getServerList
阅读全文
摘要:获取当前进程的pid import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; public static final int getProcessID() { try { Ru
阅读全文
摘要:1.@Service修饰类名,同时类继承Thread类 @Service public class MasterSchedulerService extends Thread { /** * logger of MasterSchedulerService */ private static fin
阅读全文
摘要:1.添加钩子函数,钩子函数中指定要调用的方法 @PostConstruct public void run() { this.zkClient.start(this); this.schedulerService.start(); try { logger.info("start Quartz se
阅读全文
摘要:1.关闭线程池的2个方法说明 shutdown方法:平滑的关闭ExecutorService,当此方法被调用时,ExecutorService停止接收新的任务并且等待已经提交的任务(包含提交正在执行和提交未执行)执行完成。当所有提交任务执行完毕,线程池即被关闭。 awaitTermination方法
阅读全文
摘要:6个字段组成联合唯一索引 索引名称code_level_metric_type_week_year sql语句联合索引 CREATE UNIQUE INDEX code_level_metric_type_week_year ON dept_utilization (dept_code,dept_l
阅读全文
摘要:double不是Double,无法通过 == null来判断 如何进行double的null判断呢 double avg = avg.getValue() // 此时不会报错 // 通过如下进行判断 if (Double.isNaN(avg)){ throw new RuntimeException
阅读全文
摘要:发布到线上的包结构 runtime是发布到线上的目录结构 1.项目pom.xml添加打包配置 <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-pl
阅读全文
摘要:1.三级部门分应用统计PXX逻辑 { "query": { "bool": { "must": [ { "term": { "child3DepartmentId": "00065308" } }, { "terms": { "serverUseType": [ "1", "3" ] } }, {
阅读全文
摘要:枚举类,解决重复代码块问题 public abstract class JoneEvent<T> { private EventType eventType; private String operator; private Date eventTime; private T data; publi
阅读全文
摘要:快速设置 - 如果你以前做过这种事情 HTTPSSSH Get started by creating a new file. We recommend every repository include a README, LICENSE, and .gitignore. Git global se
阅读全文
摘要:写锁和读锁成对出现,保证锁的是同一份资源 写锁正在写入的过程中,读锁获取不到,一直等待 写数据的时候,读实现不可读 适用于读多写少的场景 import sigma.resource.sync.model.DevopsData; import sigma.resource.sync.model.Jon
阅读全文
摘要:1.ReentrantLock 给类文件加锁,实现类似synchronized(class)的功能 核心是类文件中,使用static修饰的reentrantLock对象 public class SourceCache { public static final Lock reentrantLock
阅读全文
摘要:1.泛型方法声明 放在返回结果前,进行修饰,传参List infoList 进行参数的泛型支持 public <T> List<SigmaInstance> generateInstancesByDataInfoList(List<T> infoList, Map<Long, GroupInfo>
阅读全文