chanjarster commented on issue #157: [SCB-426] change type of 
CompensationContext.contexts to ConcurrentHashMap
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/157#issuecomment-376048470
 
 
   @seanyinx ``CompensableAnnotationProcessor``, which is a 
``BeanPostProcessor``, uses ``CompensableMethodCheckingCallback`` in method 
`checkMethod`:
   
   ```java
     private void checkMethod(Object bean) {
       ReflectionUtils.doWithMethods(
           bean.getClass(),
           new CompensableMethodCheckingCallback(bean, compensationContext));
     }
   ``` 
   
   Which in turn registers compensation method to `CompensationContext`:
   
   ```java
         compensationContext.addCompensationContext(signature, bean);
   ```
   
   `CompensableAnnotationProcessor` is a `BeanPostProcessor` which is called on 
bean creation, and some bean could be `@Scope("prototype")`. So it is possible 
that `CompensableAnnotationProcessor` get called not only on startup time but 
also on runtime, which in turn concurrently access 
`CompensationContext.contexts` (by `addCompensationContext` and `compensate`)
    

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to