Skip to content

EndpointInterceptor.afterCompletion is not always invoked [SWS-754] #841

@gregturn

Description

@gregturn

Lars Hvile opened SWS-754 and commented

afterCompletion's javadoc states that it will be called on any outcome of endpoint invocation, allowing for proper resource cleanup. There is however a case where handleRequest() successfully completes, but afterCompletion() is never invoked. This happens whenever an exception occurs and no EndpointExceptionResolver is able to resolve the exception.

// within dispatch()'s last catch block
catch (Exception ex) {
  Object endpoint = mappedEndpoint != null ? mappedEndpoint.getEndpoint() : null;
  processEndpointException(messageContext, endpoint, ex); // exception is rethrown here..
  triggerHandleResponse(mappedEndpoint, interceptorIndex, messageContext);
  triggerAfterCompletion(mappedEndpoint, interceptorIndex, messageContext, ex); // .. and afterCompletion() is never invoked
}

Affects: 2.0.4

Issue Links:

Referenced from: commits 6bd78f3

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions