提交 bf638f1d authored 作者: taojinlong's avatar taojinlong

fix: 校验kettle状态

上级 4891c38a
...@@ -540,7 +540,9 @@ public class ExtractDataService { ...@@ -540,7 +540,9 @@ public class ExtractDataService {
public boolean isKettleRunning(){ public boolean isKettleRunning(){
try { try {
if (InetAddress.getByName(carte).isReachable(1000)) { if (!InetAddress.getByName(carte).isReachable(1000)) {
return false;
}
HttpClient httpClient; HttpClient httpClient;
HttpGet getMethod = new HttpGet( "http://" + carte + ":" + port); HttpGet getMethod = new HttpGet( "http://" + carte + ":" + port);
HttpClientManager.HttpClientBuilderFacade clientBuilder = HttpClientManager.getInstance().createBuilder(); HttpClientManager.HttpClientBuilderFacade clientBuilder = HttpClientManager.getInstance().createBuilder();
...@@ -549,18 +551,14 @@ public class ExtractDataService { ...@@ -549,18 +551,14 @@ public class ExtractDataService {
httpClient = clientBuilder.build(); httpClient = clientBuilder.build();
HttpResponse httpResponse = httpClient.execute( getMethod ); HttpResponse httpResponse = httpClient.execute( getMethod );
int statusCode = httpResponse.getStatusLine().getStatusCode(); int statusCode = httpResponse.getStatusLine().getStatusCode();
if ( statusCode != -1 ) { if ( statusCode != -1 && statusCode < 400) {
if ( statusCode == HttpStatus.SC_UNAUTHORIZED ) { return true;
return false;
}
}
}else { }else {
return false; return false;
} }
}catch (Exception e){ }catch (Exception e){
return false; return false;
} }
return false;
} }
private static String code = "import org.pentaho.di.core.row.ValueMetaInterface;\n" + private static String code = "import org.pentaho.di.core.row.ValueMetaInterface;\n" +
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论