摘要:
父模块pom文件 <!--打包方式--> <packaging>pom</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source 阅读全文
摘要:
1 导入依赖 <!--操作redis--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> 2 阅读全文
摘要:
Future Future设计的初衷: 对将来的某个事件的结果进行建模 /* 异步调用:Ajax 1.异步执行 2.成功回调 3.失败回调 */ public class Demo01 { public static void main(String[] args) throws Execution 阅读全文
摘要:
分支合并 什么是ForkJoin ForkJoin在jdk1.7发行,并行执行任务,提高效率,适用于大数据量! 大数据:MapReduce(把大任务拆分为小任务) ForkJoin特点:工作窃取 这个里面维护的都是双端队列 ForkJoin使用 计算类 /* 求个计算的任务! 3000 6000(F 阅读全文
摘要:
// 多线程并发 public static void main(String[] args) { long start = System.currentTimeMillis(); for (int i = 0; i < 10; i++) { new Thread(() -> { // 线程体 }) 阅读全文
摘要:
public class Test { public static void main(String[] args) { User u1 = new User(1, "a", 21); User u2 = new User(2, "b", 22); User u3 = new User(3, "c" 阅读全文
摘要:
函数型接口 源码分析 @FunctionalInterface public interface Function<T, R> { /** * Applies this function to the given argument. * * @param t the function argumen 阅读全文
摘要:
三大方法 // Executors 工具类: 3大方法 // 使用了线程池之后,使用线程池来创建线程 public class Demo01 { public static void main(String[] args) { ExecutorService threadPool = Executo 阅读全文
摘要:
BlockingQueue 方式 抛出异常 有返回值,不抛出异常 阻塞等待 超时等待 添加 boolean add(E e) boolean offer(E e) void put(E e) boolean offer(E e, long timeout, TimeUnit unit) 移除 E r 阅读全文
摘要:
ReadWriteLock /* 独占锁(写锁) 一次只能被一个线程占有 共享锁(读锁) 多个线程可以同时占有 ReadWriteLock 读-读 可以共存 读-写 不能共存 写-写 不能共存 */ public class ReadWriteLockDemo { public static voi 阅读全文