package com.kangxw.springbootmultithreading;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 描述.
*
* @author : KangXW
* @version : v1.00
* @date : 2018-06-06 22:46
* @see [相关类/相关方法]
*/
@Component
public class ScheduledTask2 {
private Logger logger = LoggerFactory.getLogger(ScheduledTask2.class);
private int fixedDelayCount = 1;
private int fixedRateCount = 1;
private int initialDelayCount = 1;
private int cronCount = 1;
@Scheduled(fixedDelay = 5000) //fixedDelay = 5000表示当前方法执行完毕5000ms后,Spring scheduling会再次调用该方法
public void testFixDelay() {
logger.info("===fixedDelay: 第{}次执行方法", fixedDelayCount++);
}
@Scheduled(fixedRate = 5000) //fixedRate = 5000表示当前方法开始执行5000ms后,Spring scheduling会再次调用该方法
public void testFixedRate() {
logger.info("===fixedRate: 第{}次执行方法", fixedRateCount++);
}
@Scheduled(initialDelay = 1000, fixedRate = 5000) //initialDelay = 1000表示延迟1000ms执行第一次任务
public void testInitialDelay() {
logger.info("===initialDelay: 第{}次执行方法", initialDelayCount++);
}
@Scheduled(cron = "0 0/1 * * * ?") //cron接受cron表达式,根据cron表达式确定定时规则
public void testCron() {
logger.info("===initialDelay: 第{}次执行方法", cronCount++);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
spring-boot-multithreading.zip_spring boot_多线程
共68个文件
xml:43个
java:5个
class:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 18 浏览量
2022-09-23
04:35:37
上传
评论
收藏 94KB ZIP 举报
温馨提示
spring boot 多线程的简单例子
资源推荐
资源详情
资源评论
收起资源包目录
spring-boot-multithreading.zip (68个子文件)
gradlew.bat 2KB
gradlew 5KB
spring-boot-multithreading.iml 825B
.gradle
4.7
fileHashes
fileHashes.lock 17B
fileHashes.bin 18KB
fileChanges
last-build.bin 1B
vcsWorkingDirs
gc.properties 0B
gradle
wrapper
gradle-wrapper.jar 53KB
gradle-wrapper.properties 232B
src
test
java
com
kangxw
springbootmultithreading
SpringBootMultithreadingApplicationTests.java 379B
main
resources
application.properties 49B
java
com
kangxw
springbootmultithreading
ScheduledTask2.java 2KB
ScheduledTask.java 900B
ScheduleConfig.java 980B
SpringBootMultithreadingApplication.java 460B
.idea
gradle.xml 625B
misc.xml 258B
modules.xml 708B
compiler.xml 320B
workspace.xml 50KB
libraries
Gradle__org_apache_logging_log4j_log4j_to_slf4j_2_10_0.xml 465B
Gradle__org_springframework_spring_context_5_0_6_RELEASE.xml 623B
Gradle__org_springframework_boot_spring_boot_autoconfigure_2_0_2_RELEASE.xml 692B
Gradle__org_mockito_mockito_core_2_15_0.xml 554B
Gradle__javax_annotation_javax_annotation_api_1_3_2.xml 466B
Gradle__org_apache_logging_log4j_log4j_api_2_10_0.xml 440B
Gradle__ch_qos_logback_logback_classic_1_2_3.xml 435B
Gradle__org_springframework_spring_expression_5_0_6_RELEASE.xml 638B
Gradle__org_xmlunit_xmlunit_core_2_5_1.xml 549B
Gradle__org_objenesis_objenesis_2_6.xml 530B
Gradle__org_hamcrest_hamcrest_library_1_3.xml 294B
Gradle__org_springframework_boot_spring_boot_starter_test_2_0_2_RELEASE.xml 688B
Gradle__org_hamcrest_hamcrest_core_1_3.xml 285B
Gradle__net_bytebuddy_byte_buddy_agent_1_7_11.xml 579B
Gradle__org_yaml_snakeyaml_1_19.xml 382B
Gradle__org_springframework_spring_test_5_0_6_RELEASE.xml 608B
Gradle__org_springframework_boot_spring_boot_test_autoconfigure_2_0_2_RELEASE.xml 718B
Gradle__net_bytebuddy_byte_buddy_1_7_11.xml 550B
Gradle__org_ow2_asm_asm_5_0_4.xml 503B
Gradle__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml 361B
Gradle__org_springframework_spring_core_5_0_6_RELEASE.xml 608B
Gradle__net_minidev_json_smart_2_3.xml 527B
Gradle__ch_qos_logback_logback_core_1_2_3.xml 420B
Gradle__net_minidev_accessors_smart_1_2.xml 554B
Gradle__org_slf4j_slf4j_api_1_7_25.xml 395B
Gradle__org_assertj_assertj_core_3_9_1.xml 549B
Gradle__com_jayway_jsonpath_json_path_2_4_0.xml 558B
Gradle__org_springframework_boot_spring_boot_2_0_2_RELEASE.xml 623B
Gradle__org_springframework_spring_jcl_5_0_6_RELEASE.xml 603B
Gradle__junit_junit_4_12.xml 250B
Gradle__org_springframework_boot_spring_boot_starter_logging_2_0_2_RELEASE.xml 703B
Gradle__org_slf4j_jul_to_slf4j_1_7_25.xml 410B
Gradle__org_springframework_boot_spring_boot_starter_2_0_2_RELEASE.xml 662B
Gradle__org_springframework_spring_aop_5_0_6_RELEASE.xml 603B
Gradle__org_springframework_spring_beans_5_0_6_RELEASE.xml 613B
Gradle__org_skyscreamer_jsonassert_1_5_0.xml 288B
Gradle__org_springframework_boot_spring_boot_test_2_0_2_RELEASE.xml 648B
inspectionProfiles
Project_Default.xml 1KB
modules
spring-boot-multithreading_test.iml 5KB
spring-boot-multithreading_main.iml 3KB
out
production
resources
application.properties 49B
classes
com
kangxw
springbootmultithreading
SpringBootMultithreadingApplication.class 868B
ScheduledTask2.class 2KB
ScheduleConfig.class 932B
ScheduledTask.class 1KB
.gitignore 284B
settings.gradle 48B
build.gradle 654B
共 68 条
- 1
资源评论
林当时
- 粉丝: 97
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于matlab实现用有限元法计算电磁场的Matlab工具 .rar
- 基于matlab实现有限元算法 计算电磁场问题 边界条件包括第一类边界和第二类边界.rar
- 基于matlab实现用于计算不同车重下的电动汽车动力性和经济性.rar
- 基于matlab实现遗传算法求解多车场车辆路径问题 有多组算例可以用.rar
- 浏览器.apk
- 基于matlab实现是一个matlab中的power system 中搭建的一个模型
- 基于JSP毕业设计-教学管理系统(源代码+论文).zip
- 基于JSP毕业设计-家政管理系统-毕业设计.zip
- 基于Python实现淘宝商品评论采集(含逆向)源代码
- 基于matlab实现多目标进化算法NSGAⅡ&Matlab讲解.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功