Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Basic Watcher Class #4

Open
FosterSamuel opened this issue Feb 11, 2019 · 1 comment
Open

Build Basic Watcher Class #4

FosterSamuel opened this issue Feb 11, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@FosterSamuel
Copy link
Contributor

The Watcher class will use the SchedulerExecutorService to call a Reminder's notify method on its specific time interval. (see #3) It will do setup this repeated call in a method called schedule(reminderObject).

Relevant docs for SchedulerExecutorService: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledExecutorService.html

The Watcher class will also feature a stop(reminder) method, but that will be subject to change depending on how the Reminder object evolves to send notifications to the main driver class.

@FosterSamuel
Copy link
Contributor Author

FosterSamuel commented Feb 28, 2019

Basic scheduling is in. Every timeInterval seconds, the scheduled reminder's remind() method is called on of the available threads. The neat benefit of the scheduledThreadPool is that if a thread is idle or fails, the program doesn't come to a halt.

Missing:

  • cancelReminder(Reminder reminder) method which cancels a scheduled reminder by pulling it from activeReminders and using createRunnableCancelFor() to schedule an immediate cancellation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant