Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-job-scheduler
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4fa076be
authored
Apr 12, 2023
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
任务调度程序
1 parent
c7a31e1f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
src/main/java/cn/com/glsx/Application.java
src/main/java/cn/com/glsx/scheduler/modules/service/RestSimpleJobService.java
src/main/java/cn/com/glsx/Application.java
View file @
4fa076b
...
...
@@ -7,8 +7,11 @@ import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfigurat
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
import
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.client.loadbalancer.LoadBalanced
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.PostConstruct
;
import
java.util.TimeZone
;
...
...
@@ -35,4 +38,10 @@ public class Application {
TimeZone
.
setDefault
(
getTimeZone
(
of
(
"Asia/Shanghai"
)));
}
@LoadBalanced
@Bean
public
RestTemplate
restTemplate
()
{
return
new
RestTemplate
();
}
}
src/main/java/cn/com/glsx/scheduler/modules/service/RestSimpleJobService.java
View file @
4fa076b
...
...
@@ -13,11 +13,11 @@ public class RestSimpleJobService {
public
void
simpleJob
(
String
name
)
{
try
{
log
.
info
(
"do something for job"
);
Thread
.
sleep
(
10000
);
Thread
.
sleep
(
15000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
log
.
info
(
name
);
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment