package com.ht.hadoop.service
import java.io.{BufferedReader, InputStreamReader}
import java.net.{HttpURLConnection, URL}
import org.json.JSONArray
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
@Service
class GetInformationService {
def GetInfor(): String = {
//获取当前正在执行的app的id
val strURL = "http://192.168.42.5:4040/api/v1/applications"
val url = new URL(strURL)
val httpConn = url.openConnection.asInstanceOf[HttpURLConnection]
httpConn.setRequestMethod("GET")
httpConn.connect()
val reader = new BufferedReader(new InputStreamReader(httpConn.getInputStream))
var line: String = null
val buffer = new StringBuffer
import scala.util.control.Breaks._
breakable {
while ((line = reader.readLine()) != null) {
if (line == null) {
break;
}
解析spark api获取所有job信息
最新推荐文章于 2022-09-21 11:04:17 发布