1515@ Component
1616public class ScheduledTasks {
1717
18- @ Scheduled (initialDelay = TEN_SECONDS , fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS )
18+ @ Scheduled (initialDelay = TEN_SECONDS , fixedRate = ONE_DAY )
19+ public void createImprintUserAsync (){
20+ String msg = "create Imprint User (Async) " ;
21+ if (!schedulerProperties .getSkipFortesting ()) {
22+ Task task = asyncStartTask .createImprintUserAsync ();
23+ log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
24+ }
25+ }
26+
27+ @ Scheduled (initialDelay = TEN_SECONDS * 2 , fixedRate = FIVE_MINUTES )
1928 public void fetchTweetsFromTwitterSearch () {
2029 String msg = "fetch Tweets From TwitterSearch " ;
21- if ((schedulerProperties .getAllowUpdateTweets ()) && (!schedulerProperties .getSkipFortesting ())) {
30+ if ((schedulerProperties .getAllowFetchTweetsFromTwitterSearch ()) && (!schedulerProperties .getSkipFortesting ())) {
2231 Task task = asyncStartTask .fetchTweetsFromSearch ();
2332 log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
2433 }
2534 }
2635
27- @ Scheduled (initialDelay = TEN_SECONDS *2 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_USER_LIST )
36+ @ Scheduled (initialDelay = TEN_SECONDS * 3 , fixedRate = TWELVE_HOURS )
2837 public void fetchUsersFromDefinedUserList (){
2938 String msg = "fetch Users from Defined User List " ;
30- if ((schedulerProperties .getFetchUserListAllow ()) && (!schedulerProperties .getSkipFortesting ())) {
39+ if ((schedulerProperties .getFetchUsersFromDefinedUserListAllow ()) && (!schedulerProperties .getSkipFortesting ())) {
3140 Task task = asyncStartTask .fetchUsersFromList ();
3241 log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
3342 }
3443 }
3544
36- @ Scheduled (initialDelay = TEN_SECONDS *3 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_FOLLOWER )
45+ @ Scheduled (initialDelay = TEN_SECONDS * 4 , fixedRate = TWELVE_HOURS )
46+ public void getHomeTimeline () {
47+ String msg = "get Home Timeline Tweets " ;
48+ if ((schedulerProperties .getAllowGetHomeTimeline ()) && (!schedulerProperties .getSkipFortesting ())) {
49+ Task task = asyncStartTask .getHomeTimeline ();
50+ log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
51+ }
52+ }
53+
54+ @ Scheduled (initialDelay = TEN_SECONDS * 5 , fixedRate = TWELVE_HOURS )
55+ public void getUserTimeline () {
56+ String msg = " get User Timeline Tweets " ;
57+ if ((schedulerProperties .getAllowGetUserTimeline ()) && (!schedulerProperties .getSkipFortesting ())) {
58+ Task task = asyncStartTask .getUserTimeline ();
59+ log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
60+ }
61+ }
62+
63+ @ Scheduled (initialDelay = TEN_SECONDS * 6 , fixedRate = TWELVE_HOURS )
64+ public void getMentions () {
65+ String msg = " get Mentions " ;
66+ if ((schedulerProperties .getAllowGetMentions ()) && (!schedulerProperties .getSkipFortesting ())) {
67+ Task task = asyncStartTask .getMentions ();
68+ log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
69+ }
70+ }
71+
72+ @ Scheduled (initialDelay = TEN_SECONDS * 7 , fixedRate = TWELVE_HOURS )
73+ public void getFavorites () {
74+ String msg = " get Favorites " ;
75+ if ((schedulerProperties .getAllowGetFavorites ()) && (!schedulerProperties .getSkipFortesting ())) {
76+ Task task = asyncStartTask .getFavorites ();
77+ log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
78+ }
79+ }
80+
81+ @ Scheduled (initialDelay = TEN_SECONDS * 8 , fixedRate = TWELVE_HOURS )
82+ public void getRetweetsOfMe () {
83+ String msg = " get Retweets Of Me " ;
84+ if ((schedulerProperties .getAllowGetRetweetsOfMe ()) && (!schedulerProperties .getSkipFortesting ())) {
85+ Task task = asyncStartTask .getRetweetsOfMe ();
86+ log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
87+ }
88+ }
89+
90+ @ Scheduled (initialDelay = TEN_SECONDS * 9 , fixedRate = TWELVE_HOURS )
91+ public void getLists () {
92+ String msg = " get Lists " ;
93+ if ((schedulerProperties .getAllowGetLists ()) && (!schedulerProperties .getSkipFortesting ())) {
94+ Task task = asyncStartTask .getLists ();
95+ log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
96+ }
97+ }
98+
99+ @ Scheduled (initialDelay = TEN_SECONDS * 10 , fixedRate = ONE_DAY )
37100 public void fetchFollower (){
38101 String msg = "fetch Follower " ;
39102 if ((schedulerProperties .getFetchFollowerAllow ()) && (!schedulerProperties .getSkipFortesting ())) {
@@ -42,7 +105,7 @@ public void fetchFollower(){
42105 }
43106 }
44107
45- @ Scheduled (initialDelay = TEN_SECONDS *4 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_FRIENDS )
108+ @ Scheduled (initialDelay = TEN_SECONDS * 11 , fixedRate = ONE_DAY )
46109 public void fetchFriends (){
47110 String msg = "fetch Friends " ;
48111 if ((schedulerProperties .getFetchFriendsAllow ()) && (!schedulerProperties .getSkipFortesting ())) {
@@ -51,7 +114,7 @@ public void fetchFriends(){
51114 }
52115 }
53116
54- @ Scheduled (initialDelay = TEN_SECONDS *5 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_REMOVE_OLD_DATA_FROM_STORAGE )
117+ @ Scheduled (initialDelay = TEN_SECONDS * 12 , fixedRate = ONE_HOUR )
55118 public void removeOldDataFromStorage (){
56119 String msg = "remove Old Data From Storage: " ;
57120 if ((schedulerProperties .getRemoveOldDataFromStorageAllow ()) && (!schedulerProperties .getSkipFortesting ())) {
@@ -60,7 +123,7 @@ public void removeOldDataFromStorage(){
60123 }
61124 }
62125
63- @ Scheduled (initialDelay = TEN_SECONDS *6 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_UPDATE_USER_BY_MENTION )
126+ @ Scheduled (initialDelay = TEN_SECONDS * 13 , fixedRate = ONE_HOUR )
64127 public void updateUserProfilesFromMentions (){
65128 String msg = "update User Profiles From Mentions" ;
66129 if ((schedulerProperties .getAllowUpdateUserProfilesFromMention ()) && (!schedulerProperties .getSkipFortesting ())) {
@@ -69,7 +132,7 @@ public void updateUserProfilesFromMentions(){
69132 }
70133 }
71134
72- @ Scheduled (initialDelay = TEN_SECONDS *7 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_UPDATE_TWEETS )
135+ @ Scheduled (initialDelay = TEN_SECONDS * 14 , fixedRate = ONE_DAY )
73136 public void updateTweets () {
74137 String msg = "update Tweets " ;
75138 if ((schedulerProperties .getAllowUpdateTweets ()) && (!schedulerProperties .getSkipFortesting ())){
@@ -78,7 +141,7 @@ public void updateTweets() {
78141 }
79142 }
80143
81- @ Scheduled (initialDelay = TEN_SECONDS *8 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_UPDATE_USER )
144+ @ Scheduled (initialDelay = TEN_SECONDS * 15 , fixedRate = ONE_DAY )
82145 public void updateUserProfiles () {
83146 String msg = "update User Profiles " ;
84147 if ((schedulerProperties .getAllowUpdateUserProfiles ()) && (!schedulerProperties .getSkipFortesting ())) {
@@ -97,25 +160,13 @@ public ScheduledTasks(SchedulerProperties schedulerProperties, AsyncStartTask mq
97160
98161 public final static long ONE_MINUTE = 60 * 1000 ;
99162
163+ public final static long FIVE_MINUTES = 5 * ONE_MINUTE ;
164+
100165 public final static long ONE_HOUR = 60 * ONE_MINUTE ;
101166
102167 public final static long TWELVE_HOURS = 12 * ONE_HOUR ;
103168
104- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS = ONE_HOUR ;
105-
106- private final static long FIXED_RATE_FOR_SCHEDULAR_UPDATE_USER = TWELVE_HOURS ;
107-
108- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_FOLLOWER = TWELVE_HOURS ;
109-
110- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_FRIENDS = TWELVE_HOURS ;
111-
112- private final static long FIXED_RATE_FOR_SCHEDULAR_UPDATE_TWEETS = TWELVE_HOURS ;
113-
114- private final static long FIXED_RATE_FOR_SCHEDULAR_UPDATE_USER_BY_MENTION = ONE_HOUR ;
115-
116- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_USER_LIST = TWELVE_HOURS ;
117-
118- private final static long FIXED_RATE_FOR_SCHEDULAR_REMOVE_OLD_DATA_FROM_STORAGE = ONE_HOUR ;
169+ public final static long ONE_DAY = 24 * ONE_HOUR ;
119170
120171 private static final Logger log = LoggerFactory .getLogger (ScheduledTasks .class );
121172
0 commit comments