@ -196,7 +196,6 @@ public class InitDestroyAnnotationBeanPostProcessor
@@ -196,7 +196,6 @@ public class InitDestroyAnnotationBeanPostProcessor
}
private LifecycleMetadata buildLifecycleMetadata ( final Class < ? > clazz ) {
final boolean debug = logger . isDebugEnabled ( ) ;
List < LifecycleElement > initMethods = new ArrayList < > ( ) ;
List < LifecycleElement > destroyMethods = new ArrayList < > ( ) ;
Class < ? > targetClass = clazz ;
@ -209,14 +208,14 @@ public class InitDestroyAnnotationBeanPostProcessor
@@ -209,14 +208,14 @@ public class InitDestroyAnnotationBeanPostProcessor
if ( this . initAnnotationType ! = null & & method . isAnnotationPresent ( this . initAnnotationType ) ) {
LifecycleElement element = new LifecycleElement ( method ) ;
currInitMethods . add ( element ) ;
if ( debug ) {
logger . debug ( "Found init method on class [" + clazz . getName ( ) + "]: " + method ) ;
if ( logger . isTraceEnabled ( ) ) {
logger . trace ( "Found init method on class [" + clazz . getName ( ) + "]: " + method ) ;
}
}
if ( this . destroyAnnotationType ! = null & & method . isAnnotationPresent ( this . destroyAnnotationType ) ) {
currDestroyMethods . add ( new LifecycleElement ( method ) ) ;
if ( debug ) {
logger . debug ( "Found destroy method on class [" + clazz . getName ( ) + "]: " + method ) ;
if ( logger . isTraceEnabled ( ) ) {
logger . trace ( "Found destroy method on class [" + clazz . getName ( ) + "]: " + method ) ;
}
}
} ) ;
@ -276,8 +275,8 @@ public class InitDestroyAnnotationBeanPostProcessor
@@ -276,8 +275,8 @@ public class InitDestroyAnnotationBeanPostProcessor
if ( ! beanDefinition . isExternallyManagedInitMethod ( methodIdentifier ) ) {
beanDefinition . registerExternallyManagedInitMethod ( methodIdentifier ) ;
checkedInitMethods . add ( element ) ;
if ( logger . isDebug Enabled ( ) ) {
logger . debug ( "Registered init method on class [" + this . targetClass . getName ( ) + "]: " + element ) ;
if ( logger . isTrace Enabled ( ) ) {
logger . trace ( "Registered init method on class [" + this . targetClass . getName ( ) + "]: " + element ) ;
}
}
}
@ -287,8 +286,8 @@ public class InitDestroyAnnotationBeanPostProcessor
@@ -287,8 +286,8 @@ public class InitDestroyAnnotationBeanPostProcessor
if ( ! beanDefinition . isExternallyManagedDestroyMethod ( methodIdentifier ) ) {
beanDefinition . registerExternallyManagedDestroyMethod ( methodIdentifier ) ;
checkedDestroyMethods . add ( element ) ;
if ( logger . isDebug Enabled ( ) ) {
logger . debug ( "Registered destroy method on class [" + this . targetClass . getName ( ) + "]: " + element ) ;
if ( logger . isTrace Enabled ( ) ) {
logger . trace ( "Registered destroy method on class [" + this . targetClass . getName ( ) + "]: " + element ) ;
}
}
}
@ -301,10 +300,9 @@ public class InitDestroyAnnotationBeanPostProcessor
@@ -301,10 +300,9 @@ public class InitDestroyAnnotationBeanPostProcessor
Collection < LifecycleElement > initMethodsToIterate =
( checkedInitMethods ! = null ? checkedInitMethods : this . initMethods ) ;
if ( ! initMethodsToIterate . isEmpty ( ) ) {
boolean debug = logger . isDebugEnabled ( ) ;
for ( LifecycleElement element : initMethodsToIterate ) {
if ( debug ) {
logger . debug ( "Invoking init method on bean '" + beanName + "': " + element . getMethod ( ) ) ;
if ( logger . isTraceEnabled ( ) ) {
logger . trace ( "Invoking init method on bean '" + beanName + "': " + element . getMethod ( ) ) ;
}
element . invoke ( target ) ;
}
@ -316,10 +314,9 @@ public class InitDestroyAnnotationBeanPostProcessor
@@ -316,10 +314,9 @@ public class InitDestroyAnnotationBeanPostProcessor
Collection < LifecycleElement > destroyMethodsToUse =
( checkedDestroyMethods ! = null ? checkedDestroyMethods : this . destroyMethods ) ;
if ( ! destroyMethodsToUse . isEmpty ( ) ) {
boolean debug = logger . isDebugEnabled ( ) ;
for ( LifecycleElement element : destroyMethodsToUse ) {
if ( debug ) {
logger . debug ( "Invoking destroy method on bean '" + beanName + "': " + element . getMethod ( ) ) ;
if ( logger . isTraceEnabled ( ) ) {
logger . trace ( "Invoking destroy method on bean '" + beanName + "': " + element . getMethod ( ) ) ;
}
element . invoke ( target ) ;
}