Jump to content
  • 0

Question

Posted

I'm trying to make an event to be scheduled using a configuration. Example the Configuration looks like this:

ScheduleConfiguration = 1,10:30 ; 3,15:30 ;

basically 1 means the 1st day of week (monday) and it will start at 10:30. The next event will start in 3rd day of week at 15:30. I did split the String but i stuck on how to schedule the event to happen every X days. Any help? Thank you

7 answers to this question

Recommended Posts

  • 0
Posted (edited)

If you use aCis, you got ScheduledQuest which does exactly what you need.

 

If you don't use aCis, you have to code it yourself (using Calendar or the "new" Java8 API Time), either fully or using Quartz Scheduler for example.

Edited by Tryskell
  • 0
Posted

If you use aCis, you got ScheduledQuest which does exactly what you need.

 

If you don't use aCis, you have to code it yourself (using Calendar or the "new" Java8 API Time), either fully or using Quartz Scheduler for example.

This is my code: 

for (final String timeOfDay : Config.RESTART_INTERVAL_BY_TIME_OF_DAY)
			{
				testStartTime = Calendar.getInstance();
				testStartTime.setLenient(true);
				
				String[] parts = timeOfDay.split(",");
				
				final int day = Integer.parseInt(parts[0]);
				final int hour = Integer.parseInt(parts[1].split(":")[0]);
				final int minute = Integer.parseInt(parts[1].split(":")[1]);
				
				testStartTime.set(Calendar.DAY_OF_WEEK, day);
				testStartTime.set(Calendar.HOUR_OF_DAY, hour);
				testStartTime.set(Calendar.MINUTE, minute);
				testStartTime.set(Calendar.SECOND, 00);

				timeUntilRestart = testStartTime.getTimeInMillis() - currentTime.getTimeInMillis();

i added as test  7,20:40  so this mean the next event must be on Sunday 20:40 but it schedule it for 18/6/2017  this is 2 days ago.. 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...