Changes based on review feedback.

This commit is contained in:
WSSIA
2016-10-03 21:05:11 +01:00
parent 69cab15d75
commit 12544caa75
4 changed files with 60 additions and 8 deletions

View File

@@ -106,23 +106,23 @@ public class App {
try {
// Create an Asynchronous event.
int aEventId = eventManager.createAsync(60);
System.out.println("Event [" + aEventId + "] has been created.");
System.out.println("Async Event [" + aEventId + "] has been created.");
eventManager.start(aEventId);
System.out.println("Event [" + aEventId + "] has been started.");
System.out.println("Async Event [" + aEventId + "] has been started.");
// Create a Synchronous event.
int sEventId = eventManager.create(60);
System.out.println("Event [" + sEventId + "] has been created.");
System.out.println("Sync Event [" + sEventId + "] has been created.");
eventManager.start(sEventId);
System.out.println("Event [" + sEventId + "] has been started.");
System.out.println("Sync Event [" + sEventId + "] has been started.");
eventManager.status(aEventId);
eventManager.status(sEventId);
eventManager.cancel(aEventId);
System.out.println("Event [" + aEventId + "] has been stopped.");
System.out.println("Async Event [" + aEventId + "] has been stopped.");
eventManager.cancel(sEventId);
System.out.println("Event [" + sEventId + "] has been stopped.");
System.out.println("Sync Event [" + sEventId + "] has been stopped.");
} catch (MaxNumOfEventsAllowedException | LongRunningEventException | EventDoesNotExistException
| InvalidOperationException e) {

View File

@@ -75,7 +75,7 @@ public class Event implements IEvent, Runnable {
long endTime = currentTime + (eventTime * 1000);
while (System.currentTimeMillis() < endTime) {
try {
Thread.sleep(5000); // Sleep for 5 seconds.
Thread.sleep(1000); // Sleep for 1 second.
} catch (InterruptedException e) {
return;
}