Mọi người cho em hỏi có cách nào thay đổi các @scheduled task trong quá trình runtime của chương trình ko? Ví dụ thay đổi fixedRate của task hoặc disable task này rồi enable task kia. Nếu có code thì tốt. Em cảm ơn.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Không có cách nào em ạ, một khi đã đánh dấu
@Scheduled
Nó sẽ chạy theo 1 lộ trình cố định không thay đổi em ạ.Em có thể tự tạo cho em 1 scheduler kiểu này cũng được em ạ:
Kiểu như em đang muốn tạo api để khi admin gọi vào có thể hủy, bật schedule task, như vậy cũng ko đc sao a?
Không được em ạ, cái
@Scheduled
nó bị fix như vậy rồi, nên em cần tự tạo ra schedule của em nhé. Em có thể tham khảo ví dụ anh dùng fix rate và fix delay nhé.