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