pull/8/MERGE
xuxueli 6 years ago
parent 9e60140d09
commit ce673741c0

@ -3,6 +3,6 @@ MAINTAINER xuxueli
ENV PARAMS="" ENV PARAMS=""
ADD target/xxl-conf-admin-*.jar /app.jar ADD target/xxl-job-admin-*.jar /app.jar
ENTRYPOINT ["sh","-c","java -jar /app.jar $PARAMS"] ENTRYPOINT ["sh","-c","java -jar /app.jar $PARAMS"]

@ -28,7 +28,9 @@ public class HttpJobHandler extends IJobHandler {
} }
// httpclient // httpclient
HttpClient httpClient = new HttpClient(); HttpClient httpClient = null;
try {
httpClient = new HttpClient();
httpClient.setFollowRedirects(false); // Configure HttpClient, for example: httpClient.setFollowRedirects(false); // Configure HttpClient, for example:
httpClient.start(); // Start HttpClient httpClient.start(); // Start HttpClient
@ -47,6 +49,15 @@ public class HttpJobHandler extends IJobHandler {
String responseMsg = response.getContentAsString(); String responseMsg = response.getContentAsString();
XxlJobLogger.log(responseMsg); XxlJobLogger.log(responseMsg);
return SUCCESS; return SUCCESS;
} catch (Exception e) {
XxlJobLogger.log(e);
return FAIL;
} finally {
if (httpClient != null) {
httpClient.stop();
}
}
} }
} }

@ -32,7 +32,9 @@ public class HttpJobHandler extends IJobHandler {
} }
// httpclient // httpclient
HttpClient httpClient = new HttpClient(); HttpClient httpClient = null;
try {
httpClient = new HttpClient();
httpClient.setFollowRedirects(false); // Configure HttpClient, for example: httpClient.setFollowRedirects(false); // Configure HttpClient, for example:
httpClient.start(); // Start HttpClient httpClient.start(); // Start HttpClient
@ -51,6 +53,15 @@ public class HttpJobHandler extends IJobHandler {
String responseMsg = response.getContentAsString(); String responseMsg = response.getContentAsString();
XxlJobLogger.log(responseMsg); XxlJobLogger.log(responseMsg);
return SUCCESS; return SUCCESS;
} catch (Exception e) {
XxlJobLogger.log(e);
return FAIL;
} finally {
if (httpClient != null) {
httpClient.stop();
}
}
} }
} }

@ -32,7 +32,9 @@ public class HttpJobHandler extends IJobHandler {
} }
// httpclient // httpclient
HttpClient httpClient = new HttpClient(); HttpClient httpClient = null;
try {
httpClient = new HttpClient();
httpClient.setFollowRedirects(false); // Configure HttpClient, for example: httpClient.setFollowRedirects(false); // Configure HttpClient, for example:
httpClient.start(); // Start HttpClient httpClient.start(); // Start HttpClient
@ -51,6 +53,15 @@ public class HttpJobHandler extends IJobHandler {
String responseMsg = response.getContentAsString(); String responseMsg = response.getContentAsString();
XxlJobLogger.log(responseMsg); XxlJobLogger.log(responseMsg);
return SUCCESS; return SUCCESS;
} catch (Exception e) {
XxlJobLogger.log(e);
return FAIL;
} finally {
if (httpClient != null) {
httpClient.stop();
}
}
} }
} }

@ -32,7 +32,9 @@ public class HttpJobHandler extends IJobHandler {
} }
// httpclient // httpclient
HttpClient httpClient = new HttpClient(); HttpClient httpClient = null;
try {
httpClient = new HttpClient();
httpClient.setFollowRedirects(false); // Configure HttpClient, for example: httpClient.setFollowRedirects(false); // Configure HttpClient, for example:
httpClient.start(); // Start HttpClient httpClient.start(); // Start HttpClient
@ -51,6 +53,15 @@ public class HttpJobHandler extends IJobHandler {
String responseMsg = response.getContentAsString(); String responseMsg = response.getContentAsString();
XxlJobLogger.log(responseMsg); XxlJobLogger.log(responseMsg);
return SUCCESS; return SUCCESS;
} catch (Exception e) {
XxlJobLogger.log(e);
return FAIL;
} finally {
if (httpClient != null) {
httpClient.stop();
}
}
} }
} }

@ -5,9 +5,6 @@
<property name="log.path" value="/data/applogs/xxl-job/xxl-job-executor-sample-springboot.log"/> <property name="log.path" value="/data/applogs/xxl-job/xxl-job-executor-sample-springboot.log"/>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter" >
<level>WARN</level>
</filter>-->
<encoder> <encoder>
<pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern> <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder> </encoder>
@ -29,9 +26,4 @@
<appender-ref ref="file"/> <appender-ref ref="file"/>
</root> </root>
<!--<logger name="com.xxl.job.executor.service.info" level="WARN" additivity="false">
<appender-ref ref="console"/>
<appender-ref ref="file"/>
</logger>-->
</configuration> </configuration>
Loading…
Cancel
Save