Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix-sample
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mall
arch
matrix-sample
Commits
6fe7031f
Commit
6fe7031f
authored
Nov 18, 2019
by
QIANGLU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tomcat module
parent
712be168
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
7 deletions
+77
-7
pom.xml
spring-boot-agent-demo/pom.xml
+16
-2
AgentDemoStartup.java
spring-boot-agent-demo/src/main/java/com/matrix/agent/demo/AgentDemoStartup.java
+11
-4
AsyncConfig.java
spring-boot-agent-demo/src/main/java/com/matrix/agent/demo/config/AsyncConfig.java
+45
-0
Test.java
spring-boot-agent-demo/src/main/java/com/matrix/agent/demo/test/Test.java
+5
-1
No files found.
spring-boot-agent-demo/pom.xml
View file @
6fe7031f
...
...
@@ -7,7 +7,7 @@
<groupId>
com.matrix
</groupId>
<artifactId>
spring-boot-agent-demo
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<packaging>
war
</packaging>
<properties>
<java.version>
1.8
</java.version>
...
...
@@ -20,7 +20,7 @@
<dependencies>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
secoo-log
-starter
</artifactId>
<artifactId>
logger
-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
@@ -47,6 +47,20 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
1.18.8
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
</dependency>
</dependencies>
<build>
...
...
spring-boot-agent-demo/src/main/java/com/matrix/agent/demo/AgentDemoStartup.java
View file @
6fe7031f
...
...
@@ -3,17 +3,24 @@ package com.matrix.agent.demo;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
/**
* @author qianglu
*/
@SpringBootApplication
public
class
AgentDemoStartup
{
public
class
AgentDemoStartup
extends
SpringBootServletInitializer
{
public
static
void
main
(
String
[]
args
)
{
@Override
protected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
application
)
{
return
application
.
sources
(
AgentDemoStartup
.
class
);
}
public
static
void
main
(
String
[]
args
)
{
//
SpringApplication
.
run
(
AgentDemoStartup
.
class
,
args
);
SpringApplication
.
run
(
AgentDemoStartup
.
class
,
args
);
}
}
}
spring-boot-agent-demo/src/main/java/com/matrix/agent/demo/config/AsyncConfig.java
0 → 100644
View file @
6fe7031f
package
com
.
matrix
.
agent
.
demo
.
config
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.ThreadPoolExecutor
;
/**
* 异步线程配置
*
* @author QIANGLU on 2019/9/26
*/
@Configuration
@EnableAsync
@EnableScheduling
public
class
AsyncConfig
{
@Value
(
"${sms.executor.corePoolSize:5}"
)
private
int
corePoolSize
;
@Value
(
"${sms.executor.maxPoolSize:10}"
)
private
int
maxPoolSize
;
@Value
(
"${sms.executor.queueCapacity:200}"
)
private
int
queueCapacity
;
@Bean
(
name
=
"mailAsync"
)
public
Executor
mailAsync
()
{
ThreadPoolTaskExecutor
executor
=
new
ThreadPoolTaskExecutor
();
executor
.
setCorePoolSize
(
corePoolSize
);
executor
.
setMaxPoolSize
(
maxPoolSize
);
executor
.
setQueueCapacity
(
queueCapacity
);
executor
.
setRejectedExecutionHandler
(
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
executor
.
setThreadNamePrefix
(
"MailExecutor-"
);
executor
.
initialize
();
return
executor
;
}
}
\ No newline at end of file
spring-boot-agent-demo/src/main/java/com/matrix/agent/demo/test/Test.java
View file @
6fe7031f
package
com
.
matrix
.
agent
.
demo
.
test
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
/**
* @author QIANGLU on 2019-09-02
*/
@Component
public
class
Test
{
@Scheduled
(
fixedDelay
=
1000
)
private
void
fun1
()
throws
Exception
{
System
.
out
.
println
(
"this is fun 1."
);
Thread
.
sleep
(
500
);
}
private
void
fun2
()
throws
Exception
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment