@@ -68,34 +68,6 @@ public class BeanReloadExecutor {
6868
6969 private static AgentLogger LOGGER = AgentLogger .getLogger (BeanReloadExecutor .class );
7070
71- /**
72- * Reload bean in existing bean manager.
73- *
74- * @param bdaId the Bean Deployment Archive ID
75- * @param beanClass the bean class
76- * @param oldFullSignatures the old full signatures
77- * @param oldSignatures the old signatures
78- * @param strReloadStrategy the str reload strategy
79- */
80- public static void reloadBean (String bdaId , Class <?> beanClass , Map <String , String > oldFullSignatures ,
81- Map <String , String > oldSignatures , String strReloadStrategy ) {
82-
83- BeanReloadStrategy reloadStrategy ;
84-
85- // check if it is Object descendant (not interface)
86- if (!Object .class .isAssignableFrom (beanClass )) {
87- return ;
88- }
89-
90- try {
91- reloadStrategy = BeanReloadStrategy .valueOf (strReloadStrategy );
92- } catch (Exception e ) {
93- reloadStrategy = BeanReloadStrategy .NEVER ;
94- }
95-
96- doReloadBean (bdaId , beanClass , oldFullSignatures , oldSignatures , reloadStrategy );
97- }
98-
9971 public static void reloadBean (String bdaId , BeanManagerImpl beanManager , Class <?> beanClass , Map <String , String > oldFullSignatures ,
10072 Map <String , String > oldSignatures , String strReloadStrategy ) {
10173
@@ -114,54 +86,6 @@ public static void reloadBean(String bdaId, BeanManagerImpl beanManager, Class<?
11486 doReloadBean (bdaId , beanManager , beanClass , oldFullSignatures , oldSignatures , reloadStrategy );
11587 }
11688
117- @ SuppressWarnings ({ "rawtypes" , "unchecked" , "serial" })
118- private static void doReloadBean (String bdaId , Class <?> beanClass , Map <String , String > oldFullSignatures ,
119- Map <String , String > oldSignatures , BeanReloadStrategy reloadStrategy ) {
120-
121- BeanManagerImpl beanManager = null ;
122- BeanManager bm = CDI .current ().getBeanManager ();
123-
124- if (bm instanceof WeldManager ) {
125- bm = ((WeldManager ) bm ).unwrap ();
126- }
127-
128- if (bm instanceof BeanManagerImpl ) {
129- beanManager = (BeanManagerImpl ) bm ;
130- }
131-
132- // TODO: check if archive is excluded
133-
134- Set <Bean <?>> beans = beanManager .getBeans (beanClass , new AnnotationLiteral <Any >() {});
135-
136- if (beans != null && !beans .isEmpty ()) {
137- for (Bean <?> bean : beans ) {
138- if (bean .getBeanClass ().isInterface ()) {
139- continue ;
140- }
141- if (!fullSignatureChanged (bean , oldFullSignatures )) {
142- LOGGER .debug ("Skipping bean redefinition. Bean '{}' signature was not changed." , bean .getBeanClass ().getName ());
143- continue ;
144- }
145- if (bean instanceof AbstractClassBean ) {
146- EnhancedAnnotatedType eat = createAnnotatedTypeForExistingBeanClass (bdaId , bean );
147- if (!eat .isAbstract () || !eat .getJavaClass ().isInterface ()) { // injectionTargetCannotBeCreatedForInterface
148- ((AbstractClassBean )bean ).setProducer (beanManager .getLocalInjectionTargetFactory (eat ).createInjectionTarget (eat , bean , false ));
149- if (isReinjectingContext (bean ) || HaCdiCommons .isInExtraScope (bean )) {
150- doReloadAbstractClassBean (beanManager , (AbstractClassBean ) bean , oldSignatures , reloadStrategy );
151- LOGGER .debug ("Bean reloaded '{}'" , bean .getBeanClass ().getName ());
152- continue ;
153- }
154- }
155- LOGGER .info ("Bean '{}' redefined" , bean .getBeanClass ().getName ());
156- } else {
157- LOGGER .warning ("Bean '{}' is not AbstractClassBean, reloading/reinjection not supported." , bean .getBeanClass ().getName ());
158- }
159- }
160- } else {
161- doDefineNewManagedBean (beanManager , bdaId , beanClass );
162- }
163- }
164-
16589 @ SuppressWarnings ({ "rawtypes" , "unchecked" , "serial" })
16690 private static void doReloadBean (String bdaId , BeanManagerImpl beanManager , Class <?> beanClass , Map <String , String > oldFullSignatures ,
16791 Map <String , String > oldSignatures , BeanReloadStrategy reloadStrategy ) {
0 commit comments