Al-assad commented on code in PR #2913:
URL: 
https://github.com/apache/incubator-streampark/pull/2913#discussion_r1285007607


##########
streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/KubernetesRetriever.scala:
##########
@@ -47,15 +47,24 @@ object KubernetesRetriever extends Logger {
   // see org.apache.flink.configuration.RestOptions.RETRY_MAX_ATTEMPTS
   val FLINK_REST_RETRY_MAX_ATTEMPTS = 2
 
+  private var kubernetesClient: KubernetesClient = _
+
   /** get new KubernetesClient */
   @throws(classOf[KubernetesClientException])
-  def newK8sClient(): KubernetesClient = {
-    new DefaultKubernetesClient()
+  def getK8sClient(): KubernetesClient = {

Review Comment:
   There are better ways to implement the singleton pattern in scala:
   
   ```scala 
   private lazy val kubernetesClient: KubernetesClient = new 
DefaultKubernetesClient()
   def getK8sClient(): KubernetesClient = kubernetesClient
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to