xueli.xue 9 years ago
parent
commit
a368c707d3

+ 16 - 1
xxl-job-admin/src/main/webapp/WEB-INF/template/jobcode/index.ftl View File

@@ -94,20 +94,35 @@
94 94
 <textarea id="demoCode" style="display:none;" >
95 95
 package com.xxl.job.service.handler;
96 96
 
97
+import java.util.concurrent.TimeUnit;
98
+
97 99
 import org.slf4j.Logger;
98 100
 import org.slf4j.LoggerFactory;
101
+import org.springframework.stereotype.Service;
99 102
 
100 103
 import com.xxl.job.client.handler.IJobHandler;
104
+import com.xxl.job.client.handler.IJobHandler.JobHandleStatus;
105
+import com.xxl.job.client.handler.annotation.JobHander;
101 106
 
102 107
 public class DemoJobHandler extends IJobHandler {
103 108
 	private static transient Logger logger = LoggerFactory.getLogger(DemoJobHandler.class);
104 109
 	
105 110
 	@Override
106 111
 	public JobHandleStatus handle(String... params) throws Exception {
107
-		logger.info("demo run success...");
112
+		for (int i = 0; i < 5; i++) {
113
+			TimeUnit.SECONDS.sleep(1);
114
+			logger.info("handler run:{}", i);
115
+		}
108 116
 		return JobHandleStatus.SUCCESS;
109 117
 	}
118
+	
119
+	public static void main(String[] args) {
120
+		System.out.println(DemoJobHandler.class.getName());
121
+		System.out.println(DemoJobHandler.class);
122
+	}
123
+	
110 124
 }
125
+
111 126
 </textarea>
112 127
 	
113 128
 <@netCommon.comAlert />

+ 2 - 2
xxl-job-client/src/main/java/com/xxl/job/client/handler/HandlerRepository.java View File

@@ -46,7 +46,7 @@ public class HandlerRepository {
46 46
 	
47 47
 	// handler push to queue
48 48
 	public static String service(Map<String, String> _param) {
49
-		logger.info(">>>>>>>>>>> xxl-job service start, _param:{}", new Object[]{_param});
49
+		logger.debug(">>>>>>>>>>> xxl-job service start, _param:{}", new Object[]{_param});
50 50
 		
51 51
 		// callback
52 52
 		RemoteCallBack callback = new RemoteCallBack();
@@ -152,7 +152,7 @@ public class HandlerRepository {
152 152
 			return JacksonUtil.writeValueAsString(callback);
153 153
 		}
154 154
 		
155
-		logger.info(">>>>>>>>>>> xxl-job service end, triggerData:{}");
155
+		logger.debug(">>>>>>>>>>> xxl-job service end, triggerData:{}");
156 156
 		return JacksonUtil.writeValueAsString(callback); 
157 157
 	}
158 158