xuxueli hace 6 años
padre
commit
ce673741c0

+ 1 - 1
xxl-job-admin/Dockerfile Ver fichero

3
 
3
 
4
 ENV PARAMS=""
4
 ENV PARAMS=""
5
 
5
 
6
-ADD target/xxl-conf-admin-*.jar /app.jar
6
+ADD target/xxl-job-admin-*.jar /app.jar
7
 
7
 
8
 ENTRYPOINT ["sh","-c","java -jar /app.jar $PARAMS"]
8
 ENTRYPOINT ["sh","-c","java -jar /app.jar $PARAMS"]

+ 27 - 16
xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/jobhandler/HttpJobHandler.java Ver fichero

28
 		}
28
 		}
29
 
29
 
30
 		// httpclient
30
 		// httpclient
31
-		HttpClient httpClient = new HttpClient();
32
-		httpClient.setFollowRedirects(false);	// Configure HttpClient, for example:
33
-		httpClient.start();						// Start HttpClient
34
-
35
-		// request
36
-		Request request = httpClient.newRequest(param);
37
-		request.method(HttpMethod.GET);
38
-		request.timeout(5000, TimeUnit.MILLISECONDS);
39
-
40
-		// invoke
41
-		ContentResponse response = request.send();
42
-		if (response.getStatus() != HttpStatus.OK_200) {
43
-			XxlJobLogger.log("Http StatusCode({}) Invalid.", response.getStatus());
31
+		HttpClient httpClient = null;
32
+		try {
33
+			httpClient = new HttpClient();
34
+			httpClient.setFollowRedirects(false);	// Configure HttpClient, for example:
35
+			httpClient.start();						// Start HttpClient
36
+
37
+			// request
38
+			Request request = httpClient.newRequest(param);
39
+			request.method(HttpMethod.GET);
40
+			request.timeout(5000, TimeUnit.MILLISECONDS);
41
+
42
+			// invoke
43
+			ContentResponse response = request.send();
44
+			if (response.getStatus() != HttpStatus.OK_200) {
45
+				XxlJobLogger.log("Http StatusCode({}) Invalid.", response.getStatus());
46
+				return FAIL;
47
+			}
48
+
49
+			String responseMsg = response.getContentAsString();
50
+			XxlJobLogger.log(responseMsg);
51
+			return SUCCESS;
52
+		} catch (Exception e) {
53
+			XxlJobLogger.log(e);
44
 			return FAIL;
54
 			return FAIL;
55
+		} finally {
56
+			if (httpClient != null) {
57
+				httpClient.stop();
58
+			}
45
 		}
59
 		}
46
 
60
 
47
-		String responseMsg = response.getContentAsString();
48
-		XxlJobLogger.log(responseMsg);
49
-		return SUCCESS;
50
 	}
61
 	}
51
 
62
 
52
 }
63
 }

+ 27 - 16
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/HttpJobHandler.java Ver fichero

32
 		}
32
 		}
33
 
33
 
34
 		// httpclient
34
 		// httpclient
35
-		HttpClient httpClient = new HttpClient();
36
-		httpClient.setFollowRedirects(false);	// Configure HttpClient, for example:
37
-		httpClient.start();						// Start HttpClient
38
-
39
-		// request
40
-		Request request = httpClient.newRequest(param);
41
-		request.method(HttpMethod.GET);
42
-		request.timeout(5000, TimeUnit.MILLISECONDS);
43
-
44
-		// invoke
45
-		ContentResponse response = request.send();
46
-		if (response.getStatus() != HttpStatus.OK_200) {
47
-			XxlJobLogger.log("Http StatusCode({}) Invalid.", response.getStatus());
35
+		HttpClient httpClient = null;
36
+		try {
37
+			httpClient = new HttpClient();
38
+			httpClient.setFollowRedirects(false);	// Configure HttpClient, for example:
39
+			httpClient.start();						// Start HttpClient
40
+
41
+			// request
42
+			Request request = httpClient.newRequest(param);
43
+			request.method(HttpMethod.GET);
44
+			request.timeout(5000, TimeUnit.MILLISECONDS);
45
+
46
+			// invoke
47
+			ContentResponse response = request.send();
48
+			if (response.getStatus() != HttpStatus.OK_200) {
49
+				XxlJobLogger.log("Http StatusCode({}) Invalid.", response.getStatus());
50
+				return FAIL;
51
+			}
52
+
53
+			String responseMsg = response.getContentAsString();
54
+			XxlJobLogger.log(responseMsg);
55
+			return SUCCESS;
56
+		} catch (Exception e) {
57
+			XxlJobLogger.log(e);
48
 			return FAIL;
58
 			return FAIL;
59
+		} finally {
60
+			if (httpClient != null) {
61
+				httpClient.stop();
62
+			}
49
 		}
63
 		}
50
 
64
 
51
-		String responseMsg = response.getContentAsString();
52
-		XxlJobLogger.log(responseMsg);
53
-		return SUCCESS;
54
 	}
65
 	}
55
 
66
 
56
 }
67
 }

+ 27 - 16
xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/java/com/xxl/job/executor/service/jobhandler/HttpJobHandler.java Ver fichero

32
 		}
32
 		}
33
 
33
 
34
 		// httpclient
34
 		// httpclient
35
-		HttpClient httpClient = new HttpClient();
36
-		httpClient.setFollowRedirects(false);	// Configure HttpClient, for example:
37
-		httpClient.start();						// Start HttpClient
38
-
39
-		// request
40
-		Request request = httpClient.newRequest(param);
41
-		request.method(HttpMethod.GET);
42
-		request.timeout(5000, TimeUnit.MILLISECONDS);
43
-
44
-		// invoke
45
-		ContentResponse response = request.send();
46
-		if (response.getStatus() != HttpStatus.OK_200) {
47
-			XxlJobLogger.log("Http StatusCode({}) Invalid.", response.getStatus());
35
+		HttpClient httpClient = null;
36
+		try {
37
+			httpClient = new HttpClient();
38
+			httpClient.setFollowRedirects(false);	// Configure HttpClient, for example:
39
+			httpClient.start();						// Start HttpClient
40
+
41
+			// request
42
+			Request request = httpClient.newRequest(param);
43
+			request.method(HttpMethod.GET);
44
+			request.timeout(5000, TimeUnit.MILLISECONDS);
45
+
46
+			// invoke
47
+			ContentResponse response = request.send();
48
+			if (response.getStatus() != HttpStatus.OK_200) {
49
+				XxlJobLogger.log("Http StatusCode({}) Invalid.", response.getStatus());
50
+				return FAIL;
51
+			}
52
+
53
+			String responseMsg = response.getContentAsString();
54
+			XxlJobLogger.log(responseMsg);
55
+			return SUCCESS;
56
+		} catch (Exception e) {
57
+			XxlJobLogger.log(e);
48
 			return FAIL;
58
 			return FAIL;
59
+		} finally {
60
+			if (httpClient != null) {
61
+				httpClient.stop();
62
+			}
49
 		}
63
 		}
50
 
64
 
51
-		String responseMsg = response.getContentAsString();
52
-		XxlJobLogger.log(responseMsg);
53
-		return SUCCESS;
54
 	}
65
 	}
55
 
66
 
56
 }
67
 }

+ 27 - 16
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/HttpJobHandler.java Ver fichero

32
 		}
32
 		}
33
 
33
 
34
 		// httpclient
34
 		// httpclient
35
-		HttpClient httpClient = new HttpClient();
36
-		httpClient.setFollowRedirects(false);	// Configure HttpClient, for example:
37
-		httpClient.start();						// Start HttpClient
38
-
39
-		// request
40
-		Request request = httpClient.newRequest(param);
41
-		request.method(HttpMethod.GET);
42
-		request.timeout(5000, TimeUnit.MILLISECONDS);
43
-
44
-		// invoke
45
-		ContentResponse response = request.send();
46
-		if (response.getStatus() != HttpStatus.OK_200) {
47
-			XxlJobLogger.log("Http StatusCode({}) Invalid.", response.getStatus());
35
+		HttpClient httpClient = null;
36
+		try {
37
+			httpClient = new HttpClient();
38
+			httpClient.setFollowRedirects(false);	// Configure HttpClient, for example:
39
+			httpClient.start();						// Start HttpClient
40
+
41
+			// request
42
+			Request request = httpClient.newRequest(param);
43
+			request.method(HttpMethod.GET);
44
+			request.timeout(5000, TimeUnit.MILLISECONDS);
45
+
46
+			// invoke
47
+			ContentResponse response = request.send();
48
+			if (response.getStatus() != HttpStatus.OK_200) {
49
+				XxlJobLogger.log("Http StatusCode({}) Invalid.", response.getStatus());
50
+				return FAIL;
51
+			}
52
+
53
+			String responseMsg = response.getContentAsString();
54
+			XxlJobLogger.log(responseMsg);
55
+			return SUCCESS;
56
+		} catch (Exception e) {
57
+			XxlJobLogger.log(e);
48
 			return FAIL;
58
 			return FAIL;
59
+		} finally {
60
+			if (httpClient != null) {
61
+				httpClient.stop();
62
+			}
49
 		}
63
 		}
50
 
64
 
51
-		String responseMsg = response.getContentAsString();
52
-		XxlJobLogger.log(responseMsg);
53
-		return SUCCESS;
54
 	}
65
 	}
55
 
66
 
56
 }
67
 }

+ 0 - 8
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/logback.xml Ver fichero

5
     <property name="log.path" value="/data/applogs/xxl-job/xxl-job-executor-sample-springboot.log"/>
5
     <property name="log.path" value="/data/applogs/xxl-job/xxl-job-executor-sample-springboot.log"/>
6
 
6
 
7
     <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
7
     <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
8
-       <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter" >
9
-            <level>WARN</level>
10
-        </filter>-->
11
         <encoder>
8
         <encoder>
12
             <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
9
             <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
13
         </encoder>
10
         </encoder>
29
         <appender-ref ref="file"/>
26
         <appender-ref ref="file"/>
30
     </root>
27
     </root>
31
 
28
 
32
-    <!--<logger name="com.xxl.job.executor.service.info" level="WARN" additivity="false">
33
-        <appender-ref ref="console"/>
34
-        <appender-ref ref="file"/>
35
-    </logger>-->
36
-
37
 </configuration>
29
 </configuration>