当前位置:网站首页>Use of multithreaded executors
Use of multithreaded executors
2022-04-23 06:09:00 【linsa_ pursuer】
package com;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Executor {
public static void main(String[] args) {
Executor executor = new Executor();
executor.execution("typeOne");
}
private ExecutorService executor = Executors.newFixedThreadPool(50);
// Asynchronous task
public void execution(String name){
// Multithreading
Runnable run = new Runnable() {
@Override
public void run() {
try {
//1、 Get the execution task type
String taskId = name;
String taskName = name;
if(taskId!=null){
// Update task execution status
//2、 Call the corresponding task type
System.out.println(" Execute thread ");
}else{
throw new Exception(" Task execution failed !");
}
}catch (Exception e){
System.out.println(" Task execution failed !");
}finally {
// Update task execution end status
}
}
};
// Threads execute
executor.execute(run);
// close
executor.shutdown();
}
}
版权声明
本文为[linsa_ pursuer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220533259488.html
边栏推荐
- How does MySQL convert stored seconds into dates
- 自动控制(韩敏版)
- Latex quick start
- Understanding and use of tp50, tp90 and tp99
- Fundamentals of in-depth learning -- a simple understanding of meta learning (from Li Hongyi's course notes)
- MySQL best practices for creating tables
- PHP processing JSON_ Decode() parses JSON stringify
- PyTorch笔记——观察DataLoader&用torch构建LeNet处理CIFAR-10完整代码
- Pytorch学习记录(五):反向传播+基于梯度的优化器(SGD,Adagrad,RMSporp,Adam)
- PyTorch笔记——通过搭建ResNet熟悉网络搭建方式(完整代码)
猜你喜欢
Chapter 4 of line generation - linear correlation of vector systems
Create binary tree
Pytorch learning record (7): skills in processing data and training models
Anaconda安装PyQt5 和 pyqt5-tools后没有出现designer.exe的问题解决
Complete example demonstration of creating table to page - joint table query
PyTorch笔记——观察DataLoader&用torch构建LeNet处理CIFAR-10完整代码
编程记录——图片旋转函数scipy.ndimage.rotate()的简单使用和效果观察
Pyqy5 learning (4): qabstractbutton + qradiobutton + qcheckbox
自动控制(韩敏版)
Comparative study paper - [Moco, cvpr2020] momentum contract for unsupervised visual representation learning
随机推荐
JDBC operation transaction
Filebrowser realizes private network disk
治療TensorFlow後遺症——簡單例子記錄torch.utils.data.dataset.Dataset重寫時的圖片維度問題
A general U-shaped transformer for image restoration
编程记录——图片旋转函数scipy.ndimage.rotate()的简单使用和效果观察
JSP syntax and JSTL tag
線性代數第一章-行列式
Custom exception class
PyQy5学习(四):QAbstractButton+QRadioButton+QCheckBox
Fundamentals of SQL: first knowledge of database and SQL - installation and basic introduction - Alibaba cloud Tianchi
Pytorch学习记录(十一):数据增强、torchvision.transforms各函数讲解
Optional best practices
Rsync for file server backup
List segmentation best practices
Algèbre linéaire chapitre 1 - déterminants
Ptorch learning record (XIII): recurrent neural network
20 excellent plug-ins recommended by idea
Generate excel template (drop-down selection, multi-level linkage)
C3p0 database connection pool usage
去噪论文阅读——[CVPR2022]Blind2Unblind: Self-Supervised Image Denoising with Visible Blind Spots