{"id":10473,"date":"2020-10-10T09:44:20","date_gmt":"2020-10-10T00:44:20","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=10473"},"modified":"2020-10-25T09:21:16","modified_gmt":"2020-10-25T00:21:16","slug":"singleton-%ed%8c%a8%ed%84%b4","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=10473","title":{"rendered":"[GoF] Singleton \ud328\ud134"},"content":{"rendered":"<h4>\ud328\ud134\uba85\uce6d <\/h4>\n<p>Singleton<\/p>\n<h4>\ud544\uc694\ud55c \uc0c1\ud669 <\/h4>\n<p>\ud504\ub85c\uadf8\ub7a8\uc5d0\uc11c \uc624\uc9c1 \ub531 \ud558\ub098\uc758 \uac1d\uccb4\ub9cc \uc0dd\uc131\ud558\ub3c4\ub85d \ud558\ub294 \uc7a5\uce58\uc774\ub2e4.<\/p>\n<h4>\uc608\uc81c \ucf54\ub4dc <\/h4>\n<p>\uc0dd\uc131\uc790\ub97c private\ub85c \uc9c0\uc815\ud558\uc5ec \uc678\ubd80\uc5d0\uc11c \uc808\ub300\ub85c \uc0dd\uc131\ud560 \uc218 \uc5c6\ub3c4\ub85d \ud55c\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">\r\npackage pattern;\r\n\r\npublic class Singleton {\r\n\tprivate static Singleton self = null;\r\n\tprivate Singleton() {}\r\n\t\r\n\tpublic synchronized static Singleton getInstance() {\r\n\t\tif(self == null) {\r\n\t\t\tself = new Singleton();\r\n\t\t}\r\n\t\treturn self;\r\n\t}\r\n\t\r\n\tpublic void print() {\r\n\t\tSystem.out.println(\"I am only one.\");\r\n\t}\r\n}\r\n<\/pre>\n<p>\uc0ac\uc6a9\ud558\ub294 \ucf54\ub4dc\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">\r\npackage pattern;\r\n\r\npublic class Main {\r\n\tpublic static void main(String[] args) {\r\n\t\tSingleton s = Singleton.getInstance();\r\n\t\ts.print();\r\n\t}\r\n}\r\n<\/pre>\n<div style='background:#efefef;border-radius:8px;padding:12px 24px'>\uc774 \uae00\uc740 \uc18c\ud504\ud2b8\uc6e8\uc5b4 \uc124\uacc4\uc758 \uae30\ubc18\uc774 \ub418\ub294 GoF\uc758 \ub514\uc790\uc778\ud328\ud134\uc5d0 \ub300\ud55c \uac15\uc758\uc790\ub8cc\uc785\ub2c8\ub2e4. \uc644\uc804\ud55c \uc2e4\uc2b5\uc744 \uc704\ud574 \uc774 \uae00\uc5d0\uc11c \uc18c\uac1c\ud558\ub294 \ud074\ub798\uc2a4 \ub2e4\uc774\uc5b4\uadf8\ub7a8\uacfc \uc608\uc81c \ucf54\ub4dc\ub294 \uc644\uc804\ud558\uac8c \uc2e4\ud589\ub418\ub3c4\ub85d \uc81c\uacf5\ub418\uc9c0\ub9cc, \uc0c1\ub300\uc801\uc73c\ub85c \uc608\uc81c \ucf54\ub4dc\uc640 \uad00\ub828\ub41c \uc124\uba85\uc774 \ud568\ucd95\uc801\uc73c\ub85c \uc81c\uacf5\ub418\uace0 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \uae00\uc5d0 \ub300\ud574 \uad81\uae08\ud55c \uc810\uc774 \uc788\uc73c\uba74 \ub313\uae00\uc744 \ud1b5\ud574 \ub0a8\uaca8\uc8fc\uc2dc\uae30 \ubc14\ub78d\ub2c8\ub2e4.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\ud328\ud134\uba85\uce6d Singleton \ud544\uc694\ud55c \uc0c1\ud669 \ud504\ub85c\uadf8\ub7a8\uc5d0\uc11c \uc624\uc9c1 \ub531 \ud558\ub098\uc758 \uac1d\uccb4\ub9cc \uc0dd\uc131\ud558\ub3c4\ub85d \ud558\ub294 \uc7a5\uce58\uc774\ub2e4. \uc608\uc81c \ucf54\ub4dc \uc0dd\uc131\uc790\ub97c private\ub85c \uc9c0\uc815\ud558\uc5ec \uc678\ubd80\uc5d0\uc11c \uc808\ub300\ub85c \uc0dd\uc131\ud560 \uc218 \uc5c6\ub3c4\ub85d \ud55c\ub2e4. package pattern; public class Singleton { private static Singleton self = null; private Singleton() {} public synchronized static Singleton getInstance() { if(self == null) { self = new Singleton(); } return self; &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=10473\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;[GoF] Singleton \ud328\ud134&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-10473","post","type-post","status-publish","format-standard","hentry","category-design"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10473"}],"version-history":[{"count":3,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10473\/revisions"}],"predecessor-version":[{"id":10569,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10473\/revisions\/10569"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10473"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}