Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1.      public StatefulComponentDescription(final String componentName, final String componentClassName, final EjbJarDescription ejbJarDescription,
  2.                                          final ServiceName deploymentUnitServiceName) {
  3.          super(componentName, componentClassName, ejbJarDescription, deploymentUnitServiceName);
  4. +
  5. +        // add the session synchronization interceptor
  6. +        this.addSessionSynchronizationInterceptor();
  7.      }
  8.  
  9.      @Override
  10. @@ -135,4 +144,17 @@ public class StatefulComponentDescription extends SessionBeanComponentDescriptio
  11.          }
  12.  
  13.      }
  14. +
  15. +    private void addSessionSynchronizationInterceptor() {
  16. +        this.getConfigurators().add(new ComponentConfigurator() {
  17. +            @Override
  18. +            public void configure(DeploymentPhaseContext context, ComponentDescription description, ComponentConfiguration configuration) throws DeploymentUnitProcessingException {
  19. +                Set<Method> methods = configuration.getDefinedComponentMethods();
  20. +                for (Method method : methods) {
  21. +                    Deque<InterceptorFactory> interceptors = configuration.getComponentInterceptorDeque(method);
  22. +                    interceptors.add(new ImmediateInterceptorFactory(new StatefulSessionSynchronizationInterceptor()));
  23. +                }
  24. +            }
  25. +        });
  26. +    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement