-
Notifications
You must be signed in to change notification settings - Fork 69
Home
ansj edited this page Jun 29, 2016
·
5 revisions
In this project you can fast publish your API and schedule task, dynamic edit you java class and add or remove jar !
-
- first you need jdk8(must) and maven(not must)
- to down last release war https://github.com/NLPchina/Jcoder/releases
- run it
java -jar jcoder-[version].war
and visit
-
Click
Test
->Create-Task
Code :
package org.nlpcn.jcoder.run.java; import org.apache.log4j.Logger; import org.nlpcn.jcoder.run.annotation.DefaultExecute; import org.nutz.ioc.loader.annotation.Inject; public class TestRun { @Inject private Logger log; @DefaultExecute public String defaultTest(String name) throws InterruptedException { return "Hello Jcoder " + name; } }
select TaskType :
Active
and write some word to description now ClickSave
buttonnow you can use you api by : http://localhost:8080/api/TestRun?name=ansj
-
Click
Test
->Create-Task
Code:
package org.nlpcn.jcoder.run.java; import java.util.Date; import org.apache.log4j.Logger; import org.nlpcn.jcoder.run.annotation.DefaultExecute; import org.nlpcn.jcoder.util.DateUtils; import org.nutz.ioc.loader.annotation.Inject; public class CronTest { @Inject private Logger log ; @DefaultExecute public void execute() throws InterruptedException { Thread.sleep(10000L); log.info(DateUtils.formatDate(new Date(), DateUtils.SDF_FORMAT)); } }
select TaskType :
Active
and write some word todescription
Write Corn0/5 * * * * ?
now ClickSave
buttonnow your job every 5`s run once!