@@ -1026,34 +1026,42 @@ public void StartWorkflowExecutionWithTimeout(
1026
1026
AsyncMethodCallback resultHandler ,
1027
1027
Long timeoutInMillis )
1028
1028
throws TException {
1029
- startRequest .setRequestId (UUID .randomUUID ().toString ());
1030
- ListenableFuture <com .uber .cadence .api .v1 .StartWorkflowExecutionResponse > resultFuture =
1031
- grpcServiceStubs
1032
- .workflowFutureStub ()
1033
- .withDeadline (Deadline .after (timeoutInMillis , TimeUnit .MILLISECONDS ))
1034
- .startWorkflowExecution (RequestMapper .startWorkflowExecutionRequest (startRequest ));
1035
- resultFuture .addListener (
1036
- () -> {
1037
- try {
1038
- com .uber .cadence .api .v1 .StartWorkflowExecutionResponse response = resultFuture .get ();
1039
- resultHandler .onComplete (ResponseMapper .startWorkflowExecutionResponse (response ));
1040
- } catch (Exception e ) {
1041
- resultHandler .onError (e );
1042
- }
1043
- },
1044
- ForkJoinPool .commonPool ());
1029
+ try {
1030
+ startRequest .setRequestId (UUID .randomUUID ().toString ());
1031
+ ListenableFuture <com .uber .cadence .api .v1 .StartWorkflowExecutionResponse > resultFuture =
1032
+ grpcServiceStubs
1033
+ .workflowFutureStub ()
1034
+ .withDeadline (Deadline .after (timeoutInMillis , TimeUnit .MILLISECONDS ))
1035
+ .startWorkflowExecution (RequestMapper .startWorkflowExecutionRequest (startRequest ));
1036
+ resultFuture .addListener (
1037
+ () -> {
1038
+ try {
1039
+ com .uber .cadence .api .v1 .StartWorkflowExecutionResponse response = resultFuture .get ();
1040
+ resultHandler .onComplete (ResponseMapper .startWorkflowExecutionResponse (response ));
1041
+ } catch (Exception e ) {
1042
+ resultHandler .onError (e );
1043
+ }
1044
+ },
1045
+ ForkJoinPool .commonPool ());
1046
+ } catch (StatusRuntimeException e ) {
1047
+ throw ErrorMapper .Error (e );
1048
+ }
1045
1049
}
1046
1050
1047
1051
@ Override
1048
1052
public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistoryWithTimeout (
1049
1053
GetWorkflowExecutionHistoryRequest getRequest , Long timeoutInMillis ) throws TException {
1050
- com .uber .cadence .api .v1 .GetWorkflowExecutionHistoryResponse response =
1051
- grpcServiceStubs
1052
- .workflowBlockingStub ()
1053
- .withDeadline (Deadline .after (timeoutInMillis , TimeUnit .MILLISECONDS ))
1054
- .getWorkflowExecutionHistory (
1055
- RequestMapper .getWorkflowExecutionHistoryRequest (getRequest ));
1056
- return ResponseMapper .getWorkflowExecutionHistoryResponse (response );
1054
+ try {
1055
+ com .uber .cadence .api .v1 .GetWorkflowExecutionHistoryResponse response =
1056
+ grpcServiceStubs
1057
+ .workflowBlockingStub ()
1058
+ .withDeadline (Deadline .after (timeoutInMillis , TimeUnit .MILLISECONDS ))
1059
+ .getWorkflowExecutionHistory (
1060
+ RequestMapper .getWorkflowExecutionHistoryRequest (getRequest ));
1061
+ return ResponseMapper .getWorkflowExecutionHistoryResponse (response );
1062
+ } catch (StatusRuntimeException e ) {
1063
+ throw ErrorMapper .Error (e );
1064
+ }
1057
1065
}
1058
1066
1059
1067
@ Override
0 commit comments