Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d56be410
authored
Jan 17, 2024
by
罗志长
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
去除多余配置
parent
6ff94ce3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
30 deletions
server-common/src/main/java/com/makeit/config/AsyncConfig.java
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
server-common/src/main/java/com/makeit/config/AsyncConfig.java
deleted
100644 → 0
View file @
6ff94ce3
package
com
.
makeit
.
config
;
import
com.alibaba.ttl.threadpool.TtlExecutors
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.ThreadPoolExecutor
;
@Configuration
public
class
AsyncConfig
{
@Bean
(
name
=
"asyncTaskExecutor"
)
public
Executor
asyncTaskExecutor
()
{
ThreadPoolTaskExecutor
executor
=
new
ThreadPoolTaskExecutor
();
executor
.
setCorePoolSize
(
5
);
executor
.
setMaxPoolSize
(
10
);
executor
.
setQueueCapacity
(
500
);
executor
.
setThreadNamePrefix
(
"async-service-"
);
executor
.
setRejectedExecutionHandler
(
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
executor
.
setKeepAliveSeconds
(
60
);
executor
.
setAllowCoreThreadTimeOut
(
false
);
executor
.
initialize
();
return
TtlExecutors
.
getTtlExecutor
(
executor
);
}
}
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
View file @
d56be410
...
...
@@ -43,7 +43,6 @@ import javax.annotation.Resource;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -104,7 +103,7 @@ public class PushCallback implements MqttCallbackExtended {
}
@Override
@Async
(
"asyncTaskExecutor"
)
@Async
public
void
messageArrived
(
String
topic
,
MqttMessage
message
)
{
try
{
// 收到消息并设置返回字符串格式
...
...
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