序列化CancellationException时SWF Flow FrameWork DataConverterException

时间:2017-06-09 19:10:10

标签: amazon-web-services amazon-swf

我试图使用以下方法明确取消TryCatchFinally语句:

`TryCatchFinally executionTask = new TryCatchFinally(){
    @Override
    doTry(){
      //some nested try catch in @Async methods here.
    }`

    @Override
    protected void doCatch(final Throwable e) throws Throwable {
              //All fatal exceptions
              if (e instanceof GameDayExecutionFailureException) {
                  //doSomethin
              } else if (e instanceof CancellationException) {
                   //doSomething
             } else if (e instanceof Exception) {
                   //doSomething
     }

      @Override
            protected void doFinally() throws Throwable {
              //doCleanUp from here.
            }
    };

然后在@Signal方法中:

executionTask.cancel(null); //tried passing a new RunTime Exception here as well. 

问题是,出于某种原因,在取消所有子ActivityTasks并执行doFinally()的{​​{1}}后,工作流而不是正常退出会进一步抛出executionTask,这是导致以下堆栈跟踪:

CancellationException

我检查过 com.amazonaws.services.simpleworkflow.flow.DataConverterException: Failure serializing "java.util.concurrent.CancellationException" of type "class java.util.concurrent.CancellationException" when mapping key "null" at com.amazonaws.services.simpleworkflow.flow.JsonDataConverter.throwDataConverterException(JsonDataConverter.java:90) at com.amazonaws.services.simpleworkflow.flow.JsonDataConverter.toData(JsonDataConverter.java:78) at com.amazonaws.services.simpleworkflow.flow.pojo.POJOWorkflowDefinition.throwWorkflowException(POJOWorkflowDefinition.java:177) at com.amazonaws.services.simpleworkflow.flow.pojo.POJOWorkflowDefinition.access$300(POJOWorkflowDefinition.java:30) at com.amazonaws.services.simpleworkflow.flow.pojo.POJOWorkflowDefinition$1.doCatch(POJOWorkflowDefinition.java:93) at --- continuation ---.(:0) at com.amazonaws.services.simpleworkflow.flow.pojo.POJOWorkflowDefinition.execute(POJOWorkflowDefinition.java:67) at com.amazonaws.services.simpleworkflow.flow.worker.AsyncDecider$WorkflowExecuteAsyncScope.doAsync(AsyncDecider.java:68) Caused by: com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: com.fasterxml.jackson.databind.ObjectMapper["factory"]-> com.fasterxml.jackson.databind.MappingJsonFactory["codec"]-> com.fasterxml.jackson.databind.ObjectMapper["factory"]-> com.fasterxml.jackson.databind.MappingJsonFactory["codec"]-> com.fasterxml.jackson.databind.ObjectMapper["factory"]-> com.fasterxml.jackson.databind.MappingJsonFactory["codec"]-> com.fasterxml.jackson.databind.ObjectMapper["factory"]-> com.fasterxml.jackson.databind.MappingJsonFactory["codec"]-> com.fasterxml.jackson.databind.ObjectMapper["factory"]-> com.fasterxml.jackson.databind.MappingJsonFactory["codec"]-> .. 实例中的大部分值都是null(messege,cause)等。 但是,doCatch不应该使用该异常吗?为什么它会被抛弃?

0 个答案:

没有答案