This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev by this push:
new 7cd005e12 [Improve] http check improvement (#3386)
7cd005e12 is described below
commit 7cd005e1240a5c373718eb9eb34e80052477d312
Author: benjobs <[email protected]>
AuthorDate: Mon Dec 11 00:07:29 2023 +0800
[Improve] http check improvement (#3386)
Co-authored-by: benjobs <[email protected]>
---
.../main/scala/org/apache/streampark/common/util/Utils.scala | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git
a/streampark-common/src/main/scala/org/apache/streampark/common/util/Utils.scala
b/streampark-common/src/main/scala/org/apache/streampark/common/util/Utils.scala
index 5ab002ab2..e5bc05121 100644
---
a/streampark-common/src/main/scala/org/apache/streampark/common/util/Utils.scala
+++
b/streampark-common/src/main/scala/org/apache/streampark/common/util/Utils.scala
@@ -19,7 +19,7 @@ package org.apache.streampark.common.util
import org.apache.commons.lang3.StringUtils
import java.io._
-import java.net.URL
+import java.net.{HttpURLConnection, URL}
import java.time.{Duration, LocalDateTime}
import java.util.{jar, Collection => JavaCollection, Map => JavaMap,
Properties, UUID}
import java.util.concurrent.locks.LockSupport
@@ -156,6 +156,15 @@ object Utils extends Logger {
}
}
+ def checkHttpURL(urlString: String) = {
+ Try {
+ val url = new URL(urlString)
+ val connection = url.openConnection.asInstanceOf[HttpURLConnection]
+ connection.setRequestMethod("HEAD")
+ connection.getResponseCode == HttpURLConnection.HTTP_OK
+ }.getOrElse(false)
+ }
+
def printLogo(info: String): Unit = {
// scalastyle:off println
println("\n")