From 1445462c6ac62d3c28acdee20144692cc03342e8 Mon Sep 17 00:00:00 2001 From: niaonao Date: Mon, 8 Jun 2020 13:57:34 +0800 Subject: [PATCH] feat>Everything you want is yours --- ...45\217\257\344\273\245\350\242\253GC.java" | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 "\347\234\237\347\276\241\346\205\225\344\275\240\344\273\254\346\234\211\351\202\243\344\271\210\345\244\232\345\257\271\350\261\241\357\274\214\357\274\214\357\274\214\345\217\257\344\273\245\350\242\253GC.java" diff --git "a/\347\234\237\347\276\241\346\205\225\344\275\240\344\273\254\346\234\211\351\202\243\344\271\210\345\244\232\345\257\271\350\261\241\357\274\214\357\274\214\357\274\214\345\217\257\344\273\245\350\242\253GC.java" "b/\347\234\237\347\276\241\346\205\225\344\275\240\344\273\254\346\234\211\351\202\243\344\271\210\345\244\232\345\257\271\350\261\241\357\274\214\357\274\214\357\274\214\345\217\257\344\273\245\350\242\253GC.java" new file mode 100644 index 0000000..05d2bd0 --- /dev/null +++ "b/\347\234\237\347\276\241\346\205\225\344\275\240\344\273\254\346\234\211\351\202\243\344\271\210\345\244\232\345\257\271\350\261\241\357\274\214\357\274\214\357\274\214\345\217\257\344\273\245\350\242\253GC.java" @@ -0,0 +1,33 @@ +/** + * @className: GirlFriendSingleton + * @description: Love a person and live to death + **/ +@Slf4j +public class GirlFriendSingleton { + + // Often miss you through time and space + volatile private static GirlFriendSingleton girlFriend = null; + + private GirlFriendSingleton(){ + } + + public static GirlFriendSingleton getInstance() { + try { + // My love, Where are you + if(null == girlFriend){ + Thread.sleep(300); + // Everything you want is yours + synchronized (GirlFriendSingleton.class) { + // Only U, and it must be U + if(null == girlFriend){ + girlFriend = new GirlFriendSingleton(); + } + } + } + } catch (InterruptedException e) { + // Love a person and live to death + log.error(e.getMessage()); + } + return girlFriend; + } +} \ No newline at end of file -- Gitee