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.. 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..