this.persistenceUnitInfo = getPersistenceUnitInfo(name); assert this.persistenceUnitInfo != null; final ExecutorService taskExecutorService = ((WeldManager)CDI.current().getBeanManager()).getServices().get(ExecutorServices.class).getTaskExecutor(); assert taskExecutorService != null; if (this.isResourceLocal()) {
@Override public InterceptorBindings getInterceptorBindings(String ejbName, WeldManager manager) { EjbServices ejbServices = manager.getServices().get(EjbServices.class); if (ejbServices instanceof ForwardingEjbServices) { ejbServices = ((ForwardingEjbServices) ejbServices).delegate(); } if (ejbServices instanceof WeldEjbServices) { return ((WeldEjbServices) ejbServices).getBindings(ejbName); } return null; }
@SuppressWarnings("unchecked") private void addInterceptorInstance(Interceptor<Object> interceptor, InvocationContext invocationContext) { CreationalContext<Object> creationalContext = (CreationalContext<Object>) invocationContext.getContextData().get(SessionBeanInterceptor.CREATIONAL_CONTEXT); Object instance = beanManager.getContext(interceptor.getScope()).get(interceptor, creationalContext); SerializableContextualInstance<Interceptor<Object>,Object> serializableContextualInstance = beanManager.getServices().get(ContextualStore.class).getSerializableContextualInstance(interceptor, instance, creationalContext); interceptorInstances.put(interceptor.getBeanClass().getName(), serializableContextualInstance); }
private InterceptorBindings getInterceptorBindings(String ejbName) { EjbServices ejbServices = beanManager.getServices().get(EjbServices.class); if (ejbServices instanceof ForwardingEjbServices) { ejbServices = ((ForwardingEjbServices)ejbServices).delegate(); } InterceptorBindings interceptorBindings = null; if (ejbServices instanceof JBossEjbServices) { interceptorBindings = ((JBossEjbServices)ejbServices).getInterceptorBindings(ejbName); } return interceptorBindings; }
@SuppressWarnings("unchecked") private void addInterceptorInstance(Interceptor<Object> interceptor, InvocationContext invocationContext) { CreationalContext<Object> creationalContext = (CreationalContext<Object>) invocationContext.getContextData().get(SessionBeanInterceptor.CREATIONAL_CONTEXT); Object instance = beanManager.getContext(interceptor.getScope()).get(interceptor, creationalContext); SerializableContextualInstance<Interceptor<Object>,Object> serializableContextualInstance = beanManager.getServices().get(ContextualStore.class).<Interceptor<Object>,Object>getSerializableContextualInstance(interceptor, instance, creationalContext); interceptorInstances.put(interceptor.getBeanClass().getName(), serializableContextualInstance); }
private void init(InvocationContext invocationContext) { // create contextual instances for inteDITrceptors interceptorInstances = new ConcurrentHashMap<String, SerializableContextualInstance<Interceptor<Object>, Object>>(); EjbDescriptor<?> ejbDescriptor = (EjbDescriptor<?>) invocationContext.getContextData().get(SessionBeanInterceptor.EJB_DESCRIPTOR); EjbServices ejbServices = beanManager.getServices().get(EjbServices.class); if (ejbServices instanceof ForwardingEjbServices) { ejbServices = ((ForwardingEjbServices)ejbServices).delegate(); } if (ejbServices instanceof JBossEjbServices) { interceptorBindings = ((JBossEjbServices)ejbServices).getInterceptorBindings(ejbDescriptor); } if (interceptorBindings != null) { for (Interceptor<?> interceptor : interceptorBindings.getAllInterceptors()) { addInterceptorInstance((Interceptor<Object>)interceptor, invocationContext); } } }
private <T> boolean isMonitored(Annotated annotated, BeanAttributes<T> beanAttributes, WeldManager weldManager) { if (annotated.isAnnotationPresent(Interceptor.class) || annotated.isAnnotationPresent(Decorator.class)) { // Omit interceptors and decorators return false; } final Type type; if (annotated instanceof AnnotatedMember) { // AnnotatedField or AnnotatedMethod type = ((AnnotatedMember<?>) annotated).getDeclaringType().getBaseType(); } else { type = annotated.getBaseType(); } UnproxyableResolutionException unproxyableException = Proxies.getUnproxyableTypeException(type, weldManager.getServices()); if (unproxyableException != null) { // A bean with an interceptor must be a proxyable ProbeLogger.LOG.invocationMonitorNotAssociatedNonProxyableType(type); ProbeLogger.LOG.catchingTrace(unproxyableException); return false; } if (type instanceof Class) { final Class<?> clazz = (Class<?>) type; if (invocationMonitorExcludePattern != null && invocationMonitorExcludePattern.matcher(clazz.getName()).matches()) { ProbeLogger.LOG.invocationMonitorNotAssociatedExcluded(clazz.getName()); return false; } } return true; }
private <T> boolean isMonitored(Annotated annotated, BeanAttributes<T> beanAttributes, WeldManager weldManager) { if (annotated.isAnnotationPresent(Interceptor.class) || annotated.isAnnotationPresent(Decorator.class)) { // Omit interceptors and decorators return false; } final Type type; if (annotated instanceof AnnotatedMember) { // AnnotatedField or AnnotatedMethod type = ((AnnotatedMember<?>) annotated).getDeclaringType().getBaseType(); } else { type = annotated.getBaseType(); } UnproxyableResolutionException unproxyableException = Proxies.getUnproxyableTypeException(type, weldManager.getServices()); if (unproxyableException != null) { // A bean with an interceptor must be a proxyable ProbeLogger.LOG.invocationMonitorNotAssociatedNonProxyableType(type); ProbeLogger.LOG.catchingTrace(unproxyableException); return false; } if (type instanceof Class) { final Class<?> clazz = (Class<?>) type; if (invocationMonitorExcludePattern != null && invocationMonitorExcludePattern.matcher(clazz.getName()).matches()) { ProbeLogger.LOG.invocationMonitorNotAssociatedExcluded(clazz.getName()); return false; } } return true; }
private <T> boolean isMonitored(Annotated annotated, BeanAttributes<T> beanAttributes, WeldManager weldManager) { if (annotated.isAnnotationPresent(Interceptor.class) || annotated.isAnnotationPresent(Decorator.class)) { // Omit interceptors and decorators return false; } final Type type; if (annotated instanceof AnnotatedMember) { // AnnotatedField or AnnotatedMethod type = ((AnnotatedMember<?>) annotated).getDeclaringType().getBaseType(); } else { type = annotated.getBaseType(); } UnproxyableResolutionException unproxyableException = Proxies.getUnproxyableTypeException(type, weldManager.getServices()); if (unproxyableException != null) { // A bean with an interceptor must be a proxyable ProbeLogger.LOG.invocationMonitorNotAssociatedNonProxyableType(type); ProbeLogger.LOG.catchingTrace(unproxyableException); return false; } if (type instanceof Class) { final Class<?> clazz = (Class<?>) type; if (invocationMonitorExcludePattern != null && invocationMonitorExcludePattern.matcher(clazz.getName()).matches()) { ProbeLogger.LOG.invocationMonitorNotAssociatedExcluded(clazz.getName()); return false; } } return true; }
private <T> boolean isMonitored(Annotated annotated, BeanAttributes<T> beanAttributes, WeldManager weldManager) { if (annotated.isAnnotationPresent(Interceptor.class) || annotated.isAnnotationPresent(Decorator.class)) { // Omit interceptors and decorators return false; } final Type type; if (annotated instanceof AnnotatedMember) { // AnnotatedField or AnnotatedMethod type = ((AnnotatedMember<?>) annotated).getDeclaringType().getBaseType(); } else { type = annotated.getBaseType(); } UnproxyableResolutionException unproxyableException = Proxies.getUnproxyableTypeException(type, weldManager.getServices()); if (unproxyableException != null) { // A bean with an interceptor must be a proxyable ProbeLogger.LOG.invocationMonitorNotAssociatedNonProxyableType(type); ProbeLogger.LOG.catchingTrace(unproxyableException); return false; } if (type instanceof Class) { final Class<?> clazz = (Class<?>) type; if (invocationMonitorExcludePattern != null && invocationMonitorExcludePattern.matcher(clazz.getName()).matches()) { ProbeLogger.LOG.invocationMonitorNotAssociatedExcluded(clazz.getName()); return false; } } return true; }
private <T> boolean isMonitored(Annotated annotated, BeanAttributes<T> beanAttributes, WeldManager weldManager) { if (annotated.isAnnotationPresent(Interceptor.class) || annotated.isAnnotationPresent(Decorator.class)) { // Omit interceptors and decorators return false; } final Type type; if (annotated instanceof AnnotatedMember) { // AnnotatedField or AnnotatedMethod type = ((AnnotatedMember<?>) annotated).getDeclaringType().getBaseType(); } else { type = annotated.getBaseType(); } UnproxyableResolutionException unproxyableException = Proxies.getUnproxyableTypeException(type, weldManager.getServices()); if (unproxyableException != null) { // A bean with an interceptor must be a proxyable ProbeLogger.LOG.invocationMonitorNotAssociatedNonProxyableType(type); ProbeLogger.LOG.catchingTrace(unproxyableException); return false; } if (type instanceof Class) { final Class<?> clazz = (Class<?>) type; if (invocationMonitorExcludePattern != null && invocationMonitorExcludePattern.matcher(clazz.getName()).matches()) { ProbeLogger.LOG.invocationMonitorNotAssociatedExcluded(clazz.getName()); return false; } } return true; }
private <T> boolean isMonitored(Annotated annotated, BeanAttributes<T> beanAttributes, WeldManager weldManager) { if (annotated.isAnnotationPresent(Interceptor.class) || annotated.isAnnotationPresent(Decorator.class)) { // Omit interceptors and decorators return false; } final Type type; if (annotated instanceof AnnotatedMember) { // AnnotatedField or AnnotatedMethod type = ((AnnotatedMember<?>) annotated).getDeclaringType().getBaseType(); } else { type = annotated.getBaseType(); } UnproxyableResolutionException unproxyableException = Proxies.getUnproxyableTypeException(type, weldManager.getServices()); if (unproxyableException != null) { // A bean with an interceptor must be a proxyable ProbeLogger.LOG.invocationMonitorNotAssociatedNonProxyableType(type); ProbeLogger.LOG.catchingTrace(unproxyableException); return false; } if (type instanceof Class) { final Class<?> clazz = (Class<?>) type; if (invocationMonitorExcludePattern != null && invocationMonitorExcludePattern.matcher(clazz.getName()).matches()) { ProbeLogger.LOG.invocationMonitorNotAssociatedExcluded(clazz.getName()); return false; } } return true; }
private <T> boolean isMonitored(Annotated annotated, BeanAttributes<T> beanAttributes, WeldManager weldManager) { if (annotated.isAnnotationPresent(Interceptor.class) || annotated.isAnnotationPresent(Decorator.class)) { // Omit interceptors and decorators return false; } final Type type; if (annotated instanceof AnnotatedMember) { // AnnotatedField or AnnotatedMethod type = ((AnnotatedMember<?>) annotated).getDeclaringType().getBaseType(); } else { type = annotated.getBaseType(); } UnproxyableResolutionException unproxyableException = Proxies.getUnproxyableTypeException(type, weldManager.getServices()); if (unproxyableException != null) { // A bean with an interceptor must be a proxyable ProbeLogger.LOG.invocationMonitorNotAssociatedNonProxyableType(type); ProbeLogger.LOG.catchingTrace(unproxyableException); return false; } if (type instanceof Class) { final Class<?> clazz = (Class<?>) type; if (invocationMonitorExcludePattern != null && invocationMonitorExcludePattern.matcher(clazz.getName()).matches()) { ProbeLogger.LOG.invocationMonitorNotAssociatedExcluded(clazz.getName()); return false; } } return true; }