File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed
operator/src/main/java/oracle/kubernetes/operator/rest Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ public class RestServer {
66
66
SSL_PROTOCOL
67
67
}; // ONLY support TLSv1.2 (by default, we would get TLSv1 and TLSv1.1 too)
68
68
69
+ /**
70
+ * Create singleton instance of the WebLogic Operator's RestServer. Should only be called once.
71
+ *
72
+ * @param restConfig - the WebLogic Operator's REST configuration. Throws IllegalStateException if
73
+ * instance already created.
74
+ */
69
75
public static synchronized void create (RestConfig restConfig ) {
70
76
LOGGER .entering ();
71
77
try {
@@ -80,14 +86,31 @@ public static synchronized void create(RestConfig restConfig) {
80
86
}
81
87
}
82
88
89
+ /**
90
+ * Accessor for obtaining reference to the RestServer singleton instance.
91
+ *
92
+ * @return RestServer - Singleton instance of the RestServer
93
+ */
83
94
public static synchronized RestServer getInstance () {
84
95
return INSTANCE ;
85
96
}
86
97
98
+ /**
99
+ * Release RestServer singleton instance. Should only be called once. Throws IllegalStateException
100
+ * if singleton instance not created.
101
+ */
87
102
public static void destroy () {
88
103
LOGGER .entering ();
89
- INSTANCE = null ;
90
- LOGGER .exiting ();
104
+ try {
105
+ if (INSTANCE != null ) {
106
+ INSTANCE = null ;
107
+ return ;
108
+ }
109
+
110
+ throw new IllegalStateException ();
111
+ } finally {
112
+ LOGGER .exiting ();
113
+ }
91
114
}
92
115
93
116
/**
You can’t perform that action at this time.
0 commit comments