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 )
37- public void fetchFollower (){
38- String msg = "fetch Follower " ;
39- if ((schedulerProperties .getFetchFollowerAllow ()) && (!schedulerProperties .getSkipFortesting ())) {
40- Task task = asyncStartTask .fetchFollower ();
41- log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
42- }
43- }
44-
45- @ Scheduled (initialDelay = TEN_SECONDS *4 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_FRIENDS )
46- public void fetchFriends (){
47- String msg = "fetch Friends " ;
48- if ((schedulerProperties .getFetchFriendsAllow ()) && (!schedulerProperties .getSkipFortesting ())) {
49- Task task = asyncStartTask .fetchFriends ();
50- log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
51- }
52- }
53-
54- @ Scheduled (initialDelay = TEN_SECONDS *5 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_REMOVE_OLD_DATA_FROM_STORAGE )
55- public void removeOldDataFromStorage (){
56- String msg = "remove Old Data From Storage: " ;
57- if ((schedulerProperties .getRemoveOldDataFromStorageAllow ()) && (!schedulerProperties .getSkipFortesting ())) {
58- Task task = asyncStartTask .removeOldDataFromStorage ();
59- log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
60- }
61- }
62-
63- @ Scheduled (initialDelay = TEN_SECONDS *6 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_UPDATE_USER_BY_MENTION )
64- public void updateUserProfilesFromMentions (){
65- String msg = "update User Profiles From Mentions" ;
66- if ((schedulerProperties .getAllowUpdateUserProfilesFromMention ()) && (!schedulerProperties .getSkipFortesting ())) {
67- Task task = asyncStartTask .updateUsersFromMentions ();
68- log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
69- }
70- }
71-
72- @ Scheduled (initialDelay = TEN_SECONDS *7 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_UPDATE_TWEETS )
73- public void updateTweets () {
74- String msg = "update Tweets " ;
75- if ((schedulerProperties .getAllowUpdateTweets ()) && (!schedulerProperties .getSkipFortesting ())){
76- Task task = asyncStartTask .updateTweets ();
77- log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
78- }
79- }
80-
81- @ Scheduled (initialDelay = TEN_SECONDS *8 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_UPDATE_USER )
82- public void updateUserProfiles () {
83- String msg = "update User Profiles " ;
84- if ((schedulerProperties .getAllowUpdateUserProfiles ()) && (!schedulerProperties .getSkipFortesting ())) {
85- Task task = asyncStartTask .updateUsers ();
86- log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
87- }
88- }
89-
90- @ Scheduled (initialDelay = TEN_SECONDS *9 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS_HOME_TIMELINE )
45+ @ Scheduled (initialDelay = TEN_SECONDS * 4 , fixedRate = TWELVE_HOURS )
9146 public void getHomeTimeline () {
9247 String msg = "get Home Timeline Tweets " ;
9348 if ((schedulerProperties .getAllowGetHomeTimeline ()) && (!schedulerProperties .getSkipFortesting ())) {
@@ -96,7 +51,7 @@ public void getHomeTimeline() {
9651 }
9752 }
9853
99- @ Scheduled (initialDelay = TEN_SECONDS *10 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS_USER_TIMELINE )
54+ @ Scheduled (initialDelay = TEN_SECONDS * 5 , fixedRate = TWELVE_HOURS )
10055 public void getUserTimeline () {
10156 String msg = " get User Timeline Tweets " ;
10257 if ((schedulerProperties .getAllowGetUserTimeline ()) && (!schedulerProperties .getSkipFortesting ())) {
@@ -105,7 +60,7 @@ public void getUserTimeline() {
10560 }
10661 }
10762
108- @ Scheduled (initialDelay = TEN_SECONDS *11 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS_MENTIONS )
63+ @ Scheduled (initialDelay = TEN_SECONDS * 6 , fixedRate = TWELVE_HOURS )
10964 public void getMentions () {
11065 String msg = " get Mentions " ;
11166 if ((schedulerProperties .getAllowGetMentions ()) && (!schedulerProperties .getSkipFortesting ())) {
@@ -114,7 +69,7 @@ public void getMentions() {
11469 }
11570 }
11671
117- @ Scheduled (initialDelay = TEN_SECONDS *12 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS_FAVORITES )
72+ @ Scheduled (initialDelay = TEN_SECONDS * 7 , fixedRate = TWELVE_HOURS )
11873 public void getFavorites () {
11974 String msg = " get Favorites " ;
12075 if ((schedulerProperties .getAllowGetFavorites ()) && (!schedulerProperties .getSkipFortesting ())) {
@@ -123,7 +78,7 @@ public void getFavorites() {
12378 }
12479 }
12580
126- @ Scheduled (initialDelay = TEN_SECONDS *13 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS_RETWEETS_OF_ME )
81+ @ Scheduled (initialDelay = TEN_SECONDS * 8 , fixedRate = TWELVE_HOURS )
12782 public void getRetweetsOfMe () {
12883 String msg = " get Retweets Of Me " ;
12984 if ((schedulerProperties .getAllowGetRetweetsOfMe ()) && (!schedulerProperties .getSkipFortesting ())) {
@@ -132,7 +87,7 @@ public void getRetweetsOfMe() {
13287 }
13388 }
13489
135- @ Scheduled (initialDelay = TEN_SECONDS *14 , fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS_USER_LISTS )
90+ @ Scheduled (initialDelay = TEN_SECONDS * 9 , fixedRate = TWELVE_HOURS )
13691 public void getLists () {
13792 String msg = " get Lists " ;
13893 if ((schedulerProperties .getAllowGetLists ()) && (!schedulerProperties .getSkipFortesting ())) {
@@ -141,6 +96,60 @@ public void getLists() {
14196 }
14297 }
14398
99+ @ Scheduled (initialDelay = TEN_SECONDS * 10 , fixedRate = ONE_DAY )
100+ public void fetchFollower (){
101+ String msg = "fetch Follower " ;
102+ if ((schedulerProperties .getFetchFollowerAllow ()) && (!schedulerProperties .getSkipFortesting ())) {
103+ Task task = asyncStartTask .fetchFollower ();
104+ log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
105+ }
106+ }
107+
108+ @ Scheduled (initialDelay = TEN_SECONDS * 11 , fixedRate = ONE_DAY )
109+ public void fetchFriends (){
110+ String msg = "fetch Friends " ;
111+ if ((schedulerProperties .getFetchFriendsAllow ()) && (!schedulerProperties .getSkipFortesting ())) {
112+ Task task = asyncStartTask .fetchFriends ();
113+ log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
114+ }
115+ }
116+
117+ @ Scheduled (initialDelay = TEN_SECONDS * 12 , fixedRate = ONE_HOUR )
118+ public void removeOldDataFromStorage (){
119+ String msg = "remove Old Data From Storage: " ;
120+ if ((schedulerProperties .getRemoveOldDataFromStorageAllow ()) && (!schedulerProperties .getSkipFortesting ())) {
121+ Task task = asyncStartTask .removeOldDataFromStorage ();
122+ log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
123+ }
124+ }
125+
126+ @ Scheduled (initialDelay = TEN_SECONDS * 13 , fixedRate = ONE_HOUR )
127+ public void updateUserProfilesFromMentions (){
128+ String msg = "update User Profiles From Mentions" ;
129+ if ((schedulerProperties .getAllowUpdateUserProfilesFromMention ()) && (!schedulerProperties .getSkipFortesting ())) {
130+ Task task = asyncStartTask .updateUsersFromMentions ();
131+ log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
132+ }
133+ }
134+
135+ @ Scheduled (initialDelay = TEN_SECONDS * 14 , fixedRate = ONE_DAY )
136+ public void updateTweets () {
137+ String msg = "update Tweets " ;
138+ if ((schedulerProperties .getAllowUpdateTweets ()) && (!schedulerProperties .getSkipFortesting ())){
139+ Task task = asyncStartTask .updateTweets ();
140+ log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
141+ }
142+ }
143+
144+ @ Scheduled (initialDelay = TEN_SECONDS * 15 , fixedRate = ONE_DAY )
145+ public void updateUserProfiles () {
146+ String msg = "update User Profiles " ;
147+ if ((schedulerProperties .getAllowUpdateUserProfiles ()) && (!schedulerProperties .getSkipFortesting ())) {
148+ Task task = asyncStartTask .updateUsers ();
149+ log .info (msg + "SCHEDULED: task " +task .getUniqueId ());
150+ }
151+ }
152+
144153 @ Autowired
145154 public ScheduledTasks (SchedulerProperties schedulerProperties , AsyncStartTask mqAsyncStartTask ) {
146155 this .schedulerProperties = schedulerProperties ;
@@ -151,37 +160,13 @@ public ScheduledTasks(SchedulerProperties schedulerProperties, AsyncStartTask mq
151160
152161 public final static long ONE_MINUTE = 60 * 1000 ;
153162
163+ public final static long FIVE_MINUTES = 5 * ONE_MINUTE ;
164+
154165 public final static long ONE_HOUR = 60 * ONE_MINUTE ;
155166
156167 public final static long TWELVE_HOURS = 12 * ONE_HOUR ;
157168
158- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS = ONE_HOUR ;
159-
160- private final static long FIXED_RATE_FOR_SCHEDULAR_UPDATE_USER = TWELVE_HOURS ;
161-
162- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_FOLLOWER = TWELVE_HOURS ;
163-
164- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_FRIENDS = TWELVE_HOURS ;
165-
166- private final static long FIXED_RATE_FOR_SCHEDULAR_UPDATE_TWEETS = TWELVE_HOURS ;
167-
168- private final static long FIXED_RATE_FOR_SCHEDULAR_UPDATE_USER_BY_MENTION = ONE_HOUR ;
169-
170- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS_USER_LISTS = TWELVE_HOURS ;
171-
172- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS_FAVORITES = TWELVE_HOURS ;
173-
174- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS_RETWEETS_OF_ME = TWELVE_HOURS ;
175-
176- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS_MENTIONS = TWELVE_HOURS ;
177-
178- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS_USER_TIMELINE = TWELVE_HOURS ;
179-
180- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS_HOME_TIMELINE = TWELVE_HOURS ;
181-
182- private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_USER_LIST = TWELVE_HOURS ;
183-
184- 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 ;
185170
186171 private static final Logger log = LoggerFactory .getLogger (ScheduledTasks .class );
187172
0 commit comments