@Override public Void answer(InvocationOnMock invocation) throws Throwable { ProcedureEvent<?> event = ((ProcedureEvent<?>[]) invocation.getArgument(0))[0]; event.wakeInternal(new MasterProcedureScheduler(pid -> null) { @Override public void addFront(Iterator<Procedure> procedureIterator) { procedureIterator.forEachRemaining(wokenProcedures::add); } }); return null; } }).when(scheduler).wakeEvents(any(ProcedureEvent[].class));
/** * Wake up all of the given events. * Note that we first take scheduler lock and then wakeInternal() synchronizes on the event. * Access should remain package-private. Use ProcedureEvent class to wake/suspend events. * @param events the list of events to wake */ @VisibleForTesting public void wakeEvents(ProcedureEvent[] events) { schedLock(); try { for (ProcedureEvent event : events) { if (event == null) { continue; } event.wakeInternal(this); } } finally { schedUnlock(); } }
/** * Wake up all of the given events. * Note that we first take scheduler lock and then wakeInternal() synchronizes on the event. * Access should remain package-private. Use ProcedureEvent class to wake/suspend events. * @param events the list of events to wake */ void wakeEvents(ProcedureEvent[] events) { schedLock(); try { for (ProcedureEvent event : events) { if (event == null) { continue; } event.wakeInternal(this); } } finally { schedUnlock(); } }
/** * Wake up all of the given events. * Note that we first take scheduler lock and then wakeInternal() synchronizes on the event. * Access should remain package-private. Use ProcedureEvent class to wake/suspend events. * @param events the list of events to wake */ void wakeEvents(ProcedureEvent[] events) { schedLock(); try { for (ProcedureEvent event : events) { if (event == null) { continue; } event.wakeInternal(this); } } finally { schedUnlock(); } }