Skip to content

Commit e3eb85a

Browse files
committed
Add javadoc
1 parent 1c1352a commit e3eb85a

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

operator/src/main/java/oracle/kubernetes/operator/rest/RestServer.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ public class RestServer {
6666
SSL_PROTOCOL
6767
}; // ONLY support TLSv1.2 (by default, we would get TLSv1 and TLSv1.1 too)
6868

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+
*/
6975
public static synchronized void create(RestConfig restConfig) {
7076
LOGGER.entering();
7177
try {
@@ -80,14 +86,31 @@ public static synchronized void create(RestConfig restConfig) {
8086
}
8187
}
8288

89+
/**
90+
* Accessor for obtaining reference to the RestServer singleton instance.
91+
*
92+
* @return RestServer - Singleton instance of the RestServer
93+
*/
8394
public static synchronized RestServer getInstance() {
8495
return INSTANCE;
8596
}
8697

98+
/**
99+
* Release RestServer singleton instance. Should only be called once. Throws IllegalStateException
100+
* if singleton instance not created.
101+
*/
87102
public static void destroy() {
88103
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+
}
91114
}
92115

93116
/**

0 commit comments

Comments
 (0)