@@ -42,13 +42,13 @@ public TaskOrchestratorResult execute(List<HistoryEvent> pastEvents, List<Histor
4242 // or we receive a yield signal
4343 while (context .processNextEvent ()) { /* no method body */ }
4444 completed = true ;
45+ } catch (OrchestratorBlockedException orchestratorBlockedException ) {
46+ logger .fine ("The orchestrator has yielded and will await for new events." );
4547 } catch (Exception e ) {
4648 // The orchestrator threw an unhandled exception - fail it
4749 // TODO: What's the right way to log this?
4850 logger .warning ("The orchestrator failed with an unhandled exception: " + e .toString ());
4951 context .fail (new FailureDetails (e ));
50- } catch (OrchestratorBlockedEvent orchestratorBlockedEvent ) {
51- logger .fine ("The orchestrator has yielded and will await for new events." );
5252 }
5353
5454 if (context .continuedAsNew || (completed && context .pendingActions .isEmpty () && !context .waitingForEvents ())) {
@@ -712,11 +712,11 @@ private boolean waitingForEvents() {
712712 return this .outstandingEvents .size () > 0 ;
713713 }
714714
715- private boolean processNextEvent () throws TaskFailedException , OrchestratorBlockedEvent {
715+ private boolean processNextEvent () {
716716 return this .historyEventPlayer .moveNext ();
717717 }
718718
719- private void processEvent (HistoryEvent e ) throws TaskFailedException , OrchestratorBlockedEvent {
719+ private void processEvent (HistoryEvent e ) {
720720 switch (e .getEventTypeCase ()) {
721721 case ORCHESTRATORSTARTED :
722722 Instant instant = DataConverter .getInstantFromTimestamp (e .getTimestamp ());
@@ -826,7 +826,7 @@ public OrchestrationHistoryIterator(List<HistoryEvent> pastEvents, List<HistoryE
826826 this .currentHistoryList = pastEvents ;
827827 }
828828
829- public boolean moveNext () throws TaskFailedException , OrchestratorBlockedEvent {
829+ public boolean moveNext () {
830830 if (this .currentHistoryList == pastEvents && this .currentHistoryIndex >= pastEvents .size ()) {
831831 // Move forward to the next list
832832 this .currentHistoryList = this .newEvents ;
@@ -860,7 +860,7 @@ public ExternalEventTask(String eventName, int taskId, Duration timeout) {
860860
861861 // TODO: Shouldn't this be throws TaskCanceledException?
862862 @ Override
863- protected void handleException (Throwable e ) throws TaskFailedException {
863+ protected void handleException (Throwable e ) {
864864 // Cancellation is caused by user-specified timeouts
865865 if (e instanceof CancellationException ) {
866866 String message = String .format (
@@ -910,7 +910,7 @@ private RetriableTask(
910910 }
911911
912912 @ Override
913- public V await () throws TaskFailedException , OrchestratorBlockedEvent {
913+ public V await () {
914914 Instant startTime = this .context .getCurrentInstant ();
915915 while (true ) {
916916 Task <V > currentTask = this .taskFactory .create ();
@@ -1024,7 +1024,7 @@ public CompletableTask() {
10241024 }
10251025
10261026 @ Override
1027- public V await () throws TaskFailedException , OrchestratorBlockedEvent {
1027+ public V await () {
10281028 do {
10291029 // If the future is done, return its value right away
10301030 if (this .future .isDone ()) {
@@ -1039,14 +1039,14 @@ public V await() throws TaskFailedException, OrchestratorBlockedEvent {
10391039 } while (ContextImplTask .this .processNextEvent ());
10401040
10411041 // There's no more history left to replay and the current task is still not completed. This is normal.
1042- // The OrchestratorBlockedEvent throwable allows us to yield the current thread back to the executor so
1042+ // The OrchestratorBlockedException exception allows us to yield the current thread back to the executor so
10431043 // that we can send the current set of actions back to the worker and wait for new events to come in.
10441044 // This is *not* an exception - it's a normal part of orchestrator control flow.
1045- throw new OrchestratorBlockedEvent (
1045+ throw new OrchestratorBlockedException (
10461046 "The orchestrator is blocked and waiting for new inputs. This Throwable should never be caught by user code." );
10471047 }
10481048
1049- protected void handleException (Throwable e ) throws TaskFailedException {
1049+ protected void handleException (Throwable e ) {
10501050 if (e instanceof TaskFailedException ) {
10511051 throw (TaskFailedException )e ;
10521052 }
0 commit comments