上一页 1 2 3 4 5 6 7 8 ··· 24 下一页
摘要: /** * add 超过capacity会抛出异常 remove 队列为空会抛出异常 add和remove底层也是调用的offer和poll方法 * * offer 超过capacity会返回false poll 队列为空会返回null * * put 超过capacity会阻塞 take 队列为空 阅读全文
posted @ 2019-12-15 12:06 踏月而来 阅读(142) 评论(0) 推荐(0) 编辑
摘要: public class MyLinkedList<E> { private Node first; private int size; public int size(){ return size; } @Override public String toString() { if(size == 阅读全文
posted @ 2019-12-14 18:02 踏月而来 阅读(206) 评论(0) 推荐(0) 编辑
摘要: public class CompletableFuture3 { public static void main(String[] args) throws ExecutionException, InterruptedException { // testJoin(); testCompleta 阅读全文
posted @ 2019-12-14 11:40 踏月而来 阅读(167) 评论(0) 推荐(0) 编辑
摘要: public class CompletableFuture2 { public static void main(String[] args) throws InterruptedException { // thenAcceptBoth(); // acceptEither(); // runA 阅读全文
posted @ 2019-12-12 23:06 踏月而来 阅读(135) 评论(0) 推荐(0) 编辑
摘要: public class CompletableFutureTest { public static void main(String[] args) throws Exception { test5(); } /** * whenCompleteAsync指的是异步执行传入的BiConsumer 阅读全文
posted @ 2019-12-10 23:48 踏月而来 阅读(1081) 评论(0) 推荐(0) 编辑
摘要: controller层添加实体 html <!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF 阅读全文
posted @ 2019-12-09 16:30 踏月而来 阅读(592) 评论(0) 推荐(0) 编辑
摘要: Ctrl + N 按照类名搜索.java文件 Ctrl + Shift + N 按照文件名搜索文件,除了.java会被搜索出来,其他类型的文件也可被搜索出来 Ctrl + Shift + F 全局搜索 ,如果按了没效果则是快捷键与系统输入法冲突了,以搜狗输入法为例,将搜狗输入法的快捷键屏蔽 Ctrl 阅读全文
posted @ 2019-12-03 14:54 踏月而来 阅读(259) 评论(0) 推荐(0) 编辑
摘要: idea热加载 第一步:添加依赖 spring-boot项目中引入如下依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId></dependen 阅读全文
posted @ 2019-12-03 12:30 踏月而来 阅读(1141) 评论(0) 推荐(0) 编辑
摘要: 一句话概括,就是根据显示屏幕宽度的大小,自动的选用对应的类的样式 1、col是column简写:列 2、xs是maxsmall简写:超小, sm是small简写:小, md是medium简写:中等, lg是large简写:大; 3、-* 表示占列数,即占每行row分12列栅格系统比; 4、.col- 阅读全文
posted @ 2019-12-03 11:25 踏月而来 阅读(8670) 评论(0) 推荐(3) 编辑
摘要: 1 秒杀流程 在上面的秒杀方法中: 避免发生超卖的解决方法是:在更新库存时,where条件后面加上stock>0 避免同一个用户秒杀两件商品的方法是:在秒杀结果表中设置唯一索引(用户ID和商品ID) 秒杀业务特点:(1)并发量大 (2)有时间限制,秒杀开始时间和秒杀结束时间 (3)商品库存有限制 不 阅读全文
posted @ 2019-11-28 21:23 踏月而来 阅读(312) 评论(0) 推荐(0) 编辑
摘要: public class CompletableServiceTest { public static void main(String[] args) throws ExecutionException, InterruptedException { // test1(); // test2(); 阅读全文
posted @ 2019-11-26 23:43 踏月而来 阅读(658) 评论(0) 推荐(0) 编辑
摘要: Futrue的缺点有(1)get方法会阻塞 ,(2)不支持注册回调方法 ,(3)不支持级联操作 CompletableFuture弥补了这些缺点 public class CompletableFutureTest { public static void main(String[] args) t 阅读全文
posted @ 2019-11-25 16:36 踏月而来 阅读(502) 评论(0) 推荐(0) 编辑
摘要: ScheduledThreadPoolExecutor可以代替timer,timer的缺点是一个timer启动一个线程,如果任务数量很多,会创建很多线程,不推荐使用。 ScheduledThreadPoolExecutor他有个线程池管理线程管理所有任务,效率更高 public class Sche 阅读全文
posted @ 2019-11-23 12:04 踏月而来 阅读(1822) 评论(0) 推荐(0) 编辑
摘要: /** * CyclicBarrier 一组线程相互等待 */ public class Beer { public static void main(String[] args) { final int count = 5; final CyclicBarrier barrier = new Cy 阅读全文
posted @ 2019-11-20 17:47 踏月而来 阅读(112) 评论(0) 推荐(0) 编辑
摘要: /** * 模拟铁人三项 */ public class PhaserTest { private static Random random = new Random(System.currentTimeMillis()); public static void main(String[] args 阅读全文
posted @ 2019-11-20 17:05 踏月而来 阅读(115) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 24 下一页