|
|
@ -176,17 +176,15 @@ public class LogClient implements AutoCloseable { |
|
|
|
* remove task log |
|
|
|
* remove task log |
|
|
|
* |
|
|
|
* |
|
|
|
* @param host host |
|
|
|
* @param host host |
|
|
|
* @param port port |
|
|
|
|
|
|
|
* @param path path |
|
|
|
* @param path path |
|
|
|
* @return remove task status |
|
|
|
* @return remove task status |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Boolean removeTaskLog(String host, int port, String path) { |
|
|
|
public Boolean removeTaskLog(@NonNull Host host, String path) { |
|
|
|
logger.info("Remove task log from host: {}, port: {}, logPath {}", host, port, path); |
|
|
|
logger.info("Remove task log from host: {} logPath {}", host, path); |
|
|
|
RemoveTaskLogRequestCommand request = new RemoveTaskLogRequestCommand(path); |
|
|
|
RemoveTaskLogRequestCommand request = new RemoveTaskLogRequestCommand(path); |
|
|
|
final Host address = new Host(host, port); |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
Command command = request.convert2Command(); |
|
|
|
Command command = request.convert2Command(); |
|
|
|
Command response = this.client.sendSync(address, command, LOG_REQUEST_TIMEOUT); |
|
|
|
Command response = this.client.sendSync(host, command, LOG_REQUEST_TIMEOUT); |
|
|
|
if (response != null) { |
|
|
|
if (response != null) { |
|
|
|
RemoveTaskLogResponseCommand taskLogResponse = |
|
|
|
RemoveTaskLogResponseCommand taskLogResponse = |
|
|
|
JSONUtils.parseObject(response.getBody(), RemoveTaskLogResponseCommand.class); |
|
|
|
JSONUtils.parseObject(response.getBody(), RemoveTaskLogResponseCommand.class); |
|
|
@ -196,11 +194,11 @@ public class LogClient implements AutoCloseable { |
|
|
|
} catch (InterruptedException ex) { |
|
|
|
} catch (InterruptedException ex) { |
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
logger.error( |
|
|
|
logger.error( |
|
|
|
"Remove task log from host: {}, port: {} logPath: {} error, the current thread has been interrupted", |
|
|
|
"Remove task log from host: {}, logPath: {} error, the current thread has been interrupted", |
|
|
|
host, port, path, ex); |
|
|
|
host, path, ex); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("Remove task log from host: {}, port: {} logPath: {} error", host, port, path, e); |
|
|
|
logger.error("Remove task log from host: {}, logPath: {} error", host, path, e); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|