Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
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
liyuan
byit-myth-job
Commits
ce5f5a2c
Commit
ce5f5a2c
authored
Dec 10, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后置回调改为异步
parent
873ec79b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
1 deletion
+31
-1
RunRecordingThreadPool.java
...e/src/main/java/com/byit/conf/RunRecordingThreadPool.java
+18
-0
RunRecordingAndLogServiceImpl.java
...ervice/mapservice/impl/RunRecordingAndLogServiceImpl.java
+6
-0
ClosingExampleThreadRunHelper.java
...com/byit/thread/helper/ClosingExampleThreadRunHelper.java
+6
-0
ThreadPoolUtil.java
...dmin-core/src/main/java/com/byit/util/ThreadPoolUtil.java
+1
-1
No files found.
byit-myth-core/myth-admin-core/src/main/java/com/byit/conf/RunRecordingThreadPool.java
0 → 100644
View file @
ce5f5a2c
package
com
.
byit
.
conf
;
import
com.byit.util.ThreadPoolUtil
;
import
java.util.concurrent.ThreadPoolExecutor
;
import
java.util.concurrent.TimeUnit
;
/**
* @author Administrator
*/
public
class
RunRecordingThreadPool
{
/**
* 实例执行生命周期后置回调的线程
*/
public
static
ThreadPoolExecutor
RUN_RECORDING_THREAD_POOL
=
ThreadPoolUtil
.
createCutomizeThreadPoolExecutor
(
"RunRecordingThreadPool"
,
Runtime
.
getRuntime
().
availableProcessors
()*
2
,
100
,
60
,
TimeUnit
.
SECONDS
,
1024
);
}
byit-myth-core/myth-admin-core/src/main/java/com/byit/service/mapservice/impl/RunRecordingAndLogServiceImpl.java
View file @
ce5f5a2c
package
com
.
byit
.
service
.
mapservice
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.byit.conf.RunRecordingThreadPool
;
import
com.byit.dto.RunRecordingWrapped
;
import
com.byit.enums.EmailEnum
;
import
com.byit.enums.FlowPropertyEnum
;
...
...
@@ -151,6 +152,8 @@ public class RunRecordingAndLogServiceImpl implements RunRecordingAndLogService,
runRecordingService
.
updateRunRecordingById
(
virtualRunRecording
);
}
RunRecordingThreadPool
.
RUN_RECORDING_THREAD_POOL
.
submit
(()
->{
Map
<
String
,
InstanceRunTheLifeCycleCallback
>
beansOfType
=
SpringUtil
.
getBeansOfType
(
InstanceRunTheLifeCycleCallback
.
class
);
Set
<
Map
.
Entry
<
String
,
InstanceRunTheLifeCycleCallback
>>
entries
=
beansOfType
.
entrySet
();
//回调生命周期
...
...
@@ -158,6 +161,9 @@ public class RunRecordingAndLogServiceImpl implements RunRecordingAndLogService,
log
.
info
(
"-------------【开始回调周期{}后置】---------------"
,
entry
.
getKey
());
entry
.
getValue
().
postProcessBeforeInitialization
(
runRecording
);
}
});
});
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/helper/ClosingExampleThreadRunHelper.java
View file @
ce5f5a2c
package
com
.
byit
.
thread
.
helper
;
import
com.byit.conf.RunRecordingThreadPool
;
import
com.byit.enums.EmailEnum
;
import
com.byit.enums.NodeRunStatusPropertyEnum
;
import
com.byit.enums.RunRecordingEnum
;
...
...
@@ -77,6 +78,8 @@ public class ClosingExampleThreadRunHelper extends BaseThreadRunHelper implement
runRecording
.
setEndTime
(
new
Date
());
runRecordingService
.
updateRunRecordingById
(
runRecording
);
applicationEventPublisher
.
publishEvent
(
new
EndFlowEvent
(
this
,
runRecording
));
RunRecordingThreadPool
.
RUN_RECORDING_THREAD_POOL
.
submit
(()
->{
Map
<
String
,
InstanceRunTheLifeCycleCallback
>
beansOfType
=
SpringUtil
.
getBeansOfType
(
InstanceRunTheLifeCycleCallback
.
class
);
Set
<
Map
.
Entry
<
String
,
InstanceRunTheLifeCycleCallback
>>
entries
=
beansOfType
.
entrySet
();
//回调生命周期
...
...
@@ -84,6 +87,9 @@ public class ClosingExampleThreadRunHelper extends BaseThreadRunHelper implement
log
.
info
(
"-------------【开始回调周期{}后置】---------------"
,
entry
.
getKey
());
entry
.
getValue
().
postProcessBeforeInitialization
(
runRecording
);
}
});
}
});
return
UNIVERSAL_WAIT_TIME
;
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/util/ThreadPoolUtil.java
View file @
ce5f5a2c
...
...
@@ -70,6 +70,6 @@ public class ThreadPoolUtil {
ThreadFactory
namedThreadFactory
=
new
ThreadFactoryBuilder
().
setNameFormat
(
"[byit-myth-job]-"
+
threadName
+
"-Thread-%d"
).
build
();
return
new
ThreadPoolExecutor
(
coreCount
,
maxCount
,
keepAliveTime
,
timeUnit
,
new
LinkedBlockingQueue
<
Runnable
>(
1024
),
namedThreadFactory
,
new
ThreadPoolExecutor
.
AbortPolicy
());
new
LinkedBlockingQueue
<
Runnable
>(
queueLength
),
namedThreadFactory
,
new
ThreadPoolExecutor
.
AbortPolicy
());
}
}
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