摘要:
ConcurrentHashMap是对HashMap的高并发实现 压力测试方法: /* * boolean retrieve : 是否获取,true获取和插入,false只插入 */ public static void pressureTest(final Map<String, Integer> 阅读全文
摘要:
1.ArrayBlockingQueue 有边界2.PriorityBlockingQueue 无边界3.LinkedBlockingQueue 边界可有可无4.SynchronousQueue 新增一个元素,等待删除一个元素才会继续删除,容量大小为05.DelayQueue 延迟处理6.Linke 阅读全文
摘要:
/* * ArrayList:随机遍历比顺序遍历的效率高,因为它实现了RandomAccess接口 * LinkedList:顺序遍历比随机遍历的效率高,因为它没有实现RandomAccess接口 */ java.util.List<String> list = new ArrayList<>(); 阅读全文
摘要:
初识CompletableFuture package com.dwz.executors; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.CompletableFut 阅读全文
摘要:
使用CompletionService解决耗时时间过长任务导致的阻塞问题 package com.dwz.executors; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callabl 阅读全文
摘要:
定时任务的四种形式: 1.无返回值,入参Runnable private static void testScheduledFutureRunnable() { ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecuto 阅读全文
摘要:
future的缺陷 package com.dwz.executors; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.Callable; 阅读全文
摘要:
future.get()和Future.get(long timeout, TimeUnit unit) package com.dwz.executors; import java.util.concurrent.ExecutionException; import java.util.concu 阅读全文
摘要:
ExecutorService的终止方法 package com.dwz.executors; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.c 阅读全文
摘要:
定时任务 scheduler solution 1.Timer/TimerTask 2.SchedulerExecutorServic3.crontab 4.cron4j 5.quartz 6.Control-M(商业版的) Timer问题: 当TimerTask的执行时间超过Timer规定的任务间 阅读全文