- 博客(177)
- 收藏
- 关注
转载 【JUC系列第三篇】-CAS算法详解
作者 : 毕来生微信: 8787995791、CAS是什么?CAS是英文单词(Compare-And-Swap)的缩写,中文意思是:比较并替换。CAS需要有3个操作数:内存地址V,旧的预期值A,即将要更新的目标值B。CAS指令执行时,当且仅当内存地址V的值与预期值A相等时,将内存地址V的值修改为B,否则就什么都不做。整个比...
2019-01-02 20:01:00
168
转载 【JUC系列第二篇】-原子变量
作者:毕来生微信:8787995791、什么是原子变量? 原子变量保证了该变量的所有操作都是原子的,不会因为多线程的同时访问而导致脏数据的读取问题。2、通过synchronized保证原子操作获取锁对象获取失败/获取不到 ->阻塞队列等待释放锁对象3、Atomic之AtomicInteger源码分...
2019-01-02 19:59:00
177
转载 【JUC系列第一篇】-Volatile关键字及内存可见性
作者:毕来生微信:878799579什么是JUC?JUC全称 java.util.concurrent 是在并发编程中很常用的实用工具类2.Volatile关键字1、如果一个变量被volatile关键字修饰,那么这个变量对所有线程都是可见的。2、如果某条线程修改了被Volatile修饰的这个变量值,修改后的值对于...
2019-01-02 19:56:00
158
转载 JVM系列-001-JVM监控工具
JVM系列-001-JVM监控工具在我们安装的jdk里面的bin目录下有一个jconsole.exe程序。这就是一个JVM的监控工具。我们可以直接打开它,如果配置了环境变量,也可以在命令中直接输入jconsole命令来打开它在控制台输入jconsole,当我们打开jconsole之后,界面如下:本地进程中列出了本地所有运行...
2018-10-23 07:06:00
109
转载 Java8-CompletableFuture
import java.util.concurrent.CompletableFuture;import java.util.concurrent.ExecutionException;public class CompletableFuture1 { public static void main(String[] arg...
2017-12-16 11:05:00
85
转载 Java8-ConcurrentUtils
import java.util.concurrent.ExecutorService;import java.util.concurrent.TimeUnit;public class ConcurrentUtils { public static void stop(ExecutorService executor) {...
2017-12-16 11:04:00
116
转载 Java8-LongAccumulator
import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.atomic.LongAccumulator;import java.util.function.LongBinar...
2017-12-16 11:03:00
152
转载 Java8-Atomic
import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.atomic.AtomicInteger;import java.util.stream.IntStream;...
2017-12-16 11:00:00
87
转载 Java8-ConcurrentHashMap
import java.util.concurrent.ConcurrentHashMap;import java.util.concurrent.ForkJoinPool;public class ConcurrentHashMap1 { public static void main(String[] args) { ...
2017-12-16 10:59:00
82
转载 Java8-Synchronized-No.02
import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.stream.IntStream;public class Synchronized2 { private static fi...
2017-12-16 10:58:00
89
转载 Java8-Synchronized-No.01
import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.stream.IntStream;public class Synchronized1 { private static fi...
2017-12-16 10:58:00
114
转载 Java8-Executors-No.03
import java.util.Arrays;import java.util.List;import java.util.concurrent.Callable;import java.util.concurrent.ExecutionException;import java.util.concurrent.ExecutorS...
2017-12-16 08:02:00
80
转载 Java8-Executors-No.02
import java.util.concurrent.ExecutionException;import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.Future;imp...
2017-12-16 07:58:00
80
转载 Java8-Executors-No.01
import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.TimeUnit;public class Executors1 { public static vo...
2017-12-16 07:58:00
110
转载 Java8-Optional-No.02
import java.util.Optional;import java.util.function.Supplier;public class Optional2 { static class Outer { Nested nested = new Nested(); public Ne...
2017-12-14 09:32:00
75
转载 Java8-Optional-No.01
import java.util.Optional;public class Optional1 { public static void main(String[] args) { Optional<String> optional = Optional.of("bam"); o...
2017-12-14 09:31:00
93
转载 Java8-Concurrency
import java.util.UUID;import java.util.concurrent.ConcurrentHashMap;public class Concurrency1 { public static void main(String[] args) { ConcurrentHashMap&...
2017-12-14 09:29:00
89
转载 Java8-Annotations
import java.lang.annotation.ElementType;import java.lang.annotation.Repeatable;import java.lang.annotation.Retention;import java.lang.annotation.RetentionPolicy;import...
2017-12-14 09:28:00
145
转载 Java8-Lambda-No.05
import java.util.HashMap;import java.util.function.BiConsumer;public class Lambda5 { //Pre-Defined Functional Interfaces public static void main(String... args...
2017-12-14 09:27:00
71
转载 Java8-Lambda-No.04
public class Lambda4 { static int outerStaticNum; int outerNum; void testScopes() { int num = 1; Lambda2.Converter<Integer, String> s...
2017-12-14 09:27:00
72
转载 Java8-Lambda-No.03
import java.util.Comparator;import java.util.Objects;import java.util.UUID;import java.util.concurrent.Callable;import java.util.function.Consumer;import java.util.fu...
2017-12-14 09:26:00
51
转载 Java8-Lambda-No.02
public class Lambda2 { @FunctionalInterface public static interface Converter<F, T> { T convert(F from); } static class Something { ...
2017-12-14 09:26:00
64
转载 Java8-Lambda-No.01
import java.util.Arrays;import java.util.Collections;import java.util.Comparator;import java.util.List;import java.util.Optional;public class Lambda1 { public s...
2017-12-14 09:25:00
122
转载 Java8-Thread-No.01
import java.util.concurrent.TimeUnit;public class Threads1 { public static void main(String[] args) { test1();// test2();// test3(); }...
2017-12-13 09:05:00
223
转载 Java8-Lock-No.06
import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.locks.StampedLock;public class Lock6 { private stati...
2017-12-13 09:05:00
88
转载 Java8-Lock-No.05
import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.locks.StampedLock;public class Lock5 { public static...
2017-12-13 09:04:00
70
转载 Java8-Lock-No.04
import java.util.HashMap;import java.util.Map;import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.locks.Stamp...
2017-12-13 09:04:00
58
转载 Java8-Lock-No.03
import java.util.HashMap;import java.util.Map;import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.locks.ReadW...
2017-12-13 09:03:00
83
转载 Java8-Lock-No.02
import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.locks.ReentrantLock;public class Lock2 { public sta...
2017-12-13 09:03:00
89
转载 Java8-Lock-No.01
import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.locks.ReentrantLock;import java.util.stream.IntStream;pu...
2017-12-13 09:03:00
94
转载 Java8-Stream-No.13
import java.security.SecureRandom;import java.util.Arrays;import java.util.stream.IntStream;public class Streams13 { public static void main(String[] args) { ...
2017-12-13 08:58:00
64
转载 Java8-Stream-No.12
import java.util.ArrayList;import java.util.Arrays;import java.util.List;import java.util.UUID;import java.util.concurrent.ForkJoinPool;import java.util.concurrent.T...
2017-12-13 08:58:00
67
转载 Java8-Stream-No.11
import java.util.Arrays;import java.util.List;public class Streams11 { static class Person { String name; int age; Person(String name, int...
2017-12-13 08:57:00
76
转载 Java8-Stream-No.10
import java.util.Arrays;import java.util.IntSummaryStatistics;import java.util.List;import java.util.Map;import java.util.StringJoiner;import java.util.stream.Collec...
2017-12-12 10:00:00
75
转载 Java8-Stream-No.09
import java.util.Arrays;public class Streams9 { public static void main(String[] args) { Arrays.asList("a1", "a2", "b1", "c2", "c1") .stream()...
2017-12-12 09:59:00
63
转载 Java8-Stream-No.08
import java.util.Arrays;import java.util.stream.IntStream;import java.util.stream.Stream;public class Streams8 { public static void main(String[] args) { ...
2017-12-12 09:59:00
75
转载 Java8-Stream-No.07
import java.util.ArrayList;import java.util.List;import java.util.stream.IntStream;public class Streams7 { static class Foo { String name; List&l...
2017-12-12 09:59:00
59
转载 Java8-Stream-No.06
import java.io.IOException;import java.math.BigDecimal;import java.util.Arrays;import java.util.stream.IntStream;import java.util.stream.Stream;public class Streams6...
2017-12-12 09:58:00
72
转载 Java8-Stream-No.05
import java.util.Arrays;import java.util.List;import java.util.function.Supplier;import java.util.stream.Stream;public class Streams5 { public static void main(...
2017-12-12 09:58:00
73
转载 Java8-Stream-No.04
import java.util.OptionalInt;import java.util.stream.IntStream;public class Streams4 { public static void main(String[] args) { for (int i = 0; i < 10; ...
2017-12-12 09:57:00
74
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人