上一页 1 ··· 7 8 9 10 11 12 13 下一页
摘要: 1. Controller接收Date类型的数据 核心使用@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") 来将传递过来的时间字符串转化为Date类型 @RestController @RequestMapping("res") public clas 阅读全文
posted @ 2021-06-01 10:24 SpecialSpeculator 阅读(639) 评论(0) 推荐(0)
摘要: AutomicBoolean 介绍 java并发包下提供的原子变量,是原子类其中之一。基本特性是在多线程环境下,多个线程同时执行这些类的实例包含的方法时,具有排他性 当某个线程进入方法,不会被其他线程打断,而其他线程就像自旋转一样,等待该方法执行完成 原子性操作 阅读全文
posted @ 2021-05-31 16:33 SpecialSpeculator 阅读(693) 评论(0) 推荐(0)
摘要: 1.使用场景 @Resource和@Autowired都是做bean注入时使用 @Resource是jdk的注解,不是spring的注解;由包javax.annotation.Resource提供,需要导入,但是Spring支持该注解注入 2.相同点,不同点 共同点:两者都可以写在setter方法, 阅读全文
posted @ 2021-05-31 15:57 SpecialSpeculator 阅读(1783) 评论(0) 推荐(0)
摘要: 1.配置文件添加paginationInterceptor @Configuration @MapperScan("fama.cost.*.mapper") public class SpringConnectionFactory { @Bean public MybatisPlusIntercep 阅读全文
posted @ 2021-05-28 17:38 SpecialSpeculator 阅读(676) 评论(0) 推荐(0)
摘要: 1.引入依赖 <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <depende 阅读全文
posted @ 2021-05-18 20:01 SpecialSpeculator 阅读(125) 评论(0) 推荐(0)
摘要: 1.mybatis的多参数使用 mapper 使用 通过@param注解,传递到xml中的参数名称指定 public interface RedisInstanceTypesMapper extends BaseMapper<RedisInstanceType> { ; List<RedisInst 阅读全文
posted @ 2021-05-17 14:10 SpecialSpeculator 阅读(122) 评论(0) 推荐(0)
摘要: 1.接口 RequestType 是泛型,不是具体的类 T 也是泛型,不是具体类,只是这个泛型必须extends CloudResult public interface CloudClient<RequestType, T extends CloudResult> { CloudResponse< 阅读全文
posted @ 2021-05-13 18:46 SpecialSpeculator 阅读(282) 评论(0) 推荐(0)
摘要: stream分组后的map是有序map List<RedisInstanceTypeDto> typeDtoList = ModuleHelper.mapAll(redisInstanceTypes,RedisInstanceTypeDto.class); Map<Integer,List<Redi 阅读全文
posted @ 2021-05-12 20:32 SpecialSpeculator 阅读(1685) 评论(0) 推荐(0)
摘要: 1.pom引入 <dependency> <groupId>org.modelmapper</groupId> <artifactId>modelmapper</artifactId> <version>2.3.8</version> </dependency> 2.将DAO对象转为DTO对象 Us 阅读全文
posted @ 2021-05-12 16:47 SpecialSpeculator 阅读(707) 评论(0) 推荐(0)
摘要: 当使用mybatis plus3.2.0+springboot2.1.1 报错 Error attempting to get column from result set 1.一般出现这种问题,最简单的错误可能是因为数据库的字段类型和实体类的类型不一致 2.但我不是,我是因为在实体类里面使用了@b 阅读全文
posted @ 2021-05-12 13:44 SpecialSpeculator 阅读(6350) 评论(1) 推荐(1)
摘要: 1.通用对象PriceRequest public class PriceRequest { protected String regionId; protected int count; protected String pinAlias; protected ApplyType applyTyp 阅读全文
posted @ 2021-05-11 17:25 SpecialSpeculator 阅读(77) 评论(0) 推荐(0)
摘要: 1.Optional orElse orElseThrow ifPresent ofNullable() of() map() 2.优雅使用optional进行为null的if-else判断 Optional.ofNullable(rule).map(r -> { context.getProces 阅读全文
posted @ 2021-05-07 18:34 SpecialSpeculator 阅读(41) 评论(0) 推荐(0)
摘要: 解决maven依赖冲突问题 1.idea 安装maven helper插件 2.打开pom.xml文件 底部多出一个Dependency Analyzer选项 点开这个选项 找到冲突,点击右键,选择Exclude即可排除冲突版本的jar包 阅读全文
posted @ 2021-05-07 10:18 SpecialSpeculator 阅读(331) 评论(0) 推荐(0)
摘要: 设计模式,建造者模式 常见使用方法builder,build 去掉new 关键字使用 public class TestPod { private String ip; public interface Builder { Builder setIp(String ip); TestPod buil 阅读全文
posted @ 2021-05-06 15:19 SpecialSpeculator 阅读(40) 评论(0) 推荐(0)
摘要: 经济学是个体做选择 接下来,就是如何做选择 2个假设 (1)资源是永远稀缺的(不只只钱) 相对于个人的欲望,能拥有的东西是少的 人的欲望是一层一层产生的,无穷无尽的,欲望是好事,欲望推动了人类社会往前走 买房子,2室一厅,3室一厅 幻想别墅,联排,双拼 独栋别墅,豪宅 (精神追求阻碍物质的欲望,环保 阅读全文
posted @ 2021-04-20 13:39 SpecialSpeculator 阅读(105) 评论(0) 推荐(0)
摘要: 理论课1 :经济学世界观 1.经济学研究什么 做选择,个体做选择,团体做选择 人的选择 经济学家眼里,人就是不断的做选择做选择做选择 早上吃什么,开车安全带 是否好好工作 谁洗衣,做饭 谁坐公交,谁坐法拉利呢 组织的选择 政府,企业,大学,小团体都可以对外做出独立决策的团体 2.经济学和金融学的区别 阅读全文
posted @ 2021-04-15 21:19 SpecialSpeculator 阅读(100) 评论(0) 推荐(0)
摘要: 1.经济学的核心原理 1.1 第一章:经济学是什么 还没入门,还没会怎么用,会觉得纸上谈兵,没什么用,没意义。 学傻了,学入门了,走的太远,掉书袋,开始宣扬经济学万能论。 学精了,学会怎么去利用。高端的赚钱方法都是写在经济学里的。 微观经济学8字箴言: 洗脑需求控制供给 宏观经济学8字箴言: 经济危 阅读全文
posted @ 2021-04-14 14:35 SpecialSpeculator 阅读(335) 评论(0) 推荐(0)
摘要: 并发队列 多个线程有次序共享数据的重要组件 并发队列和并发集合的区别 并发集合是在多个线程中共享数据的 并发队列,遵循先入先出原则,排队检票的意思,用来解决大数据量采集处理和显示的 并发队列,阻塞还是非阻塞 Queue接口的BlockingQueue是阻塞度列,另一个无阻塞队列 阻塞队列和非阻塞度列 阅读全文
posted @ 2021-04-08 20:14 SpecialSpeculator 阅读(91) 评论(0) 推荐(0)
摘要: 1.异步转同步,线程池提交任务,阻塞获取结果 ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) ThreadUtils.newDaemonFixedThreadExecutor("PodActionService" , Runt 阅读全文
posted @ 2021-03-31 20:08 SpecialSpeculator 阅读(443) 评论(0) 推荐(0)
摘要: 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 阅读全文
posted @ 2021-03-31 13:34 SpecialSpeculator 阅读(369) 评论(0) 推荐(0)
摘要: 优雅的sprongboot启动类 package fama.cost.server; import fama.cost.common.IStoppable; import fama.cost.common.thread.Stopper; import fama.cost.dao.utils.Bean 阅读全文
posted @ 2021-03-30 14:26 SpecialSpeculator 阅读(202) 评论(0) 推荐(0)
摘要: 1.application.properties zookeeper.address=@mvn.zookeeper.address@ zookeeper.namespace=@mvn.zookeeper.namespace@ 2.pom.xml中多profile环境不同变量定义 <propertie 阅读全文
posted @ 2021-03-30 13:55 SpecialSpeculator 阅读(638) 评论(0) 推荐(0)
摘要: 1.生成zk客户端对象 private CuratorFramework buildClient() { logger.info("zookeeper registry center init, server lists is: {}.", zookeeperConfig.getServerList 阅读全文
posted @ 2021-03-30 13:44 SpecialSpeculator 阅读(225) 评论(0) 推荐(0)
摘要: 获取当前进程的pid import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; public static final int getProcessID() { try { Ru 阅读全文
posted @ 2021-03-29 16:15 SpecialSpeculator 阅读(183) 评论(0) 推荐(0)
摘要: 1.@Service修饰类名,同时类继承Thread类 @Service public class MasterSchedulerService extends Thread { /** * logger of MasterSchedulerService */ private static fin 阅读全文
posted @ 2021-03-29 16:10 SpecialSpeculator 阅读(136) 评论(0) 推荐(0)
摘要: 1.添加钩子函数,钩子函数中指定要调用的方法 @PostConstruct public void run() { this.zkClient.start(this); this.schedulerService.start(); try { logger.info("start Quartz se 阅读全文
posted @ 2021-03-26 11:32 SpecialSpeculator 阅读(246) 评论(0) 推荐(0)
摘要: 1.关闭线程池的2个方法说明 shutdown方法:平滑的关闭ExecutorService,当此方法被调用时,ExecutorService停止接收新的任务并且等待已经提交的任务(包含提交正在执行和提交未执行)执行完成。当所有提交任务执行完毕,线程池即被关闭。 awaitTermination方法 阅读全文
posted @ 2021-03-26 09:57 SpecialSpeculator 阅读(280) 评论(0) 推荐(0)
摘要: 6个字段组成联合唯一索引 索引名称code_level_metric_type_week_year sql语句联合索引 CREATE UNIQUE INDEX code_level_metric_type_week_year ON dept_utilization (dept_code,dept_l 阅读全文
posted @ 2021-03-15 17:35 SpecialSpeculator 阅读(780) 评论(0) 推荐(0)
摘要: double不是Double,无法通过 == null来判断 如何进行double的null判断呢 double avg = avg.getValue() // 此时不会报错 // 通过如下进行判断 if (Double.isNaN(avg)){ throw new RuntimeException 阅读全文
posted @ 2021-03-15 17:31 SpecialSpeculator 阅读(2673) 评论(0) 推荐(0)
摘要: 发布到线上的包结构 runtime是发布到线上的目录结构 1.项目pom.xml添加打包配置 <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-pl 阅读全文
posted @ 2021-03-12 15:14 SpecialSpeculator 阅读(138) 评论(0) 推荐(0)
摘要: 1.三级部门分应用统计PXX逻辑 { "query": { "bool": { "must": [ { "term": { "child3DepartmentId": "00065308" } }, { "terms": { "serverUseType": [ "1", "3" ] } }, { 阅读全文
posted @ 2021-03-11 18:03 SpecialSpeculator 阅读(183) 评论(0) 推荐(0)
摘要: 枚举类,解决重复代码块问题 public abstract class JoneEvent<T> { private EventType eventType; private String operator; private Date eventTime; private T data; publi 阅读全文
posted @ 2021-03-10 16:23 SpecialSpeculator 阅读(191) 评论(0) 推荐(0)
摘要: 快速设置 - 如果你以前做过这种事情 HTTPSSSH Get started by creating a new file. We recommend every repository include a README, LICENSE, and .gitignore. Git global se 阅读全文
posted @ 2021-03-10 14:46 SpecialSpeculator 阅读(66) 评论(0) 推荐(0)
摘要: 写锁和读锁成对出现,保证锁的是同一份资源 写锁正在写入的过程中,读锁获取不到,一直等待 写数据的时候,读实现不可读 适用于读多写少的场景 import sigma.resource.sync.model.DevopsData; import sigma.resource.sync.model.Jon 阅读全文
posted @ 2021-03-10 14:31 SpecialSpeculator 阅读(85) 评论(0) 推荐(0)
摘要: 1.ReentrantLock 给类文件加锁,实现类似synchronized(class)的功能 核心是类文件中,使用static修饰的reentrantLock对象 public class SourceCache { public static final Lock reentrantLock 阅读全文
posted @ 2021-03-10 10:14 SpecialSpeculator 阅读(109) 评论(0) 推荐(0)
摘要: 1.泛型方法声明 放在返回结果前,进行修饰,传参List infoList 进行参数的泛型支持 public <T> List<SigmaInstance> generateInstancesByDataInfoList(List<T> infoList, Map<Long, GroupInfo> 阅读全文
posted @ 2021-03-10 10:10 SpecialSpeculator 阅读(114) 评论(0) 推荐(0)
摘要: 批量执行异步任务CompletionService 核心思想,就是将异步结果放入到阻塞队列中,然后再消费队列,实现异步任务批量执行 接口方法说明 Future<V> submit(Callable<V> task); Future<V> submit(Runnable task, V result) 阅读全文
posted @ 2021-02-18 17:42 SpecialSpeculator 阅读(50) 评论(0) 推荐(0)
摘要: 多线程优化性能,串行操作并行化 串行操作 // 以下2个都是耗时操作 doBizA(); doBizB(); 修改变为并行化 new Thread(() -> doBizA()).start(); new Thread(() -> doBizB()).start(); 异步化,是并行方案的基础,利用 阅读全文
posted @ 2021-02-07 15:55 SpecialSpeculator 阅读(120) 评论(0) 推荐(0)
摘要: Condition 一个Lock中应该绑定一个Condition对象。Condition是Java提供用来实现等待/通知的类。 我们知道Object对象提供了wait、waitAll、notify、notifyAll的方法用来实现线程的同步、等待和唤醒。 但Condition类提供了比wait/no 阅读全文
posted @ 2021-01-14 15:18 SpecialSpeculator 阅读(98) 评论(0) 推荐(0)
摘要: 列表分片,及并行执行样例 Set<String> ips = Stream.of("1","2","3","4","5","6","7","8","9","10") // 按照2个为一组,进行切片操作 List<List<String>> partition = Lists.partition(Li 阅读全文
posted @ 2021-01-05 11:30 SpecialSpeculator 阅读(171) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 下一页