fix: 校验kettle状态
This commit is contained in:
parent
4891c38a8e
commit
bf638f1d95
@ -540,27 +540,25 @@ public class ExtractDataService {
|
|||||||
|
|
||||||
public boolean isKettleRunning(){
|
public boolean isKettleRunning(){
|
||||||
try {
|
try {
|
||||||
if (InetAddress.getByName(carte).isReachable(1000)) {
|
if (!InetAddress.getByName(carte).isReachable(1000)) {
|
||||||
HttpClient httpClient;
|
return false;
|
||||||
HttpGet getMethod = new HttpGet( "http://" + carte + ":" + port);
|
}
|
||||||
HttpClientManager.HttpClientBuilderFacade clientBuilder = HttpClientManager.getInstance().createBuilder();
|
HttpClient httpClient;
|
||||||
clientBuilder.setConnectionTimeout(1);
|
HttpGet getMethod = new HttpGet( "http://" + carte + ":" + port);
|
||||||
clientBuilder.setCredentials(user, passwd);
|
HttpClientManager.HttpClientBuilderFacade clientBuilder = HttpClientManager.getInstance().createBuilder();
|
||||||
httpClient = clientBuilder.build();
|
clientBuilder.setConnectionTimeout(1);
|
||||||
HttpResponse httpResponse = httpClient.execute( getMethod );
|
clientBuilder.setCredentials(user, passwd);
|
||||||
int statusCode = httpResponse.getStatusLine().getStatusCode();
|
httpClient = clientBuilder.build();
|
||||||
if ( statusCode != -1 ) {
|
HttpResponse httpResponse = httpClient.execute( getMethod );
|
||||||
if ( statusCode == HttpStatus.SC_UNAUTHORIZED ) {
|
int statusCode = httpResponse.getStatusLine().getStatusCode();
|
||||||
return false;
|
if ( statusCode != -1 && statusCode < 400) {
|
||||||
}
|
return true;
|
||||||
}
|
|
||||||
}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" +
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user