Look this up lazily
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/48fe4caa Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/48fe4caa Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/48fe4caa Branch: refs/heads/master Commit: 48fe4caa3fefe0053b52b941d7ee4246ddedc509 Parents: 15df1fe Author: Jonathan Gallimore <j...@jrg.me.uk> Authored: Wed Apr 15 10:59:32 2015 +0100 Committer: Jonathan Gallimore <j...@jrg.me.uk> Committed: Wed Apr 15 11:58:49 2015 +0100 ---------------------------------------------------------------------- .../java/org/apache/openejb/assembler/classic/Assembler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/48fe4caa/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java index 2c63f36..2ddef7b 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java @@ -1757,7 +1757,7 @@ public class Assembler extends AssemblerTool implements org.apache.openejb.spi.A private void destroyResource(final String name, final String className, final Object object) { - final Method preDestroy = findPreDestroy(object); + Method preDestroy = null; if (object instanceof ResourceAdapterReference) { final ResourceAdapterReference resourceAdapter = (ResourceAdapterReference) object; @@ -1817,7 +1817,7 @@ public class Assembler extends AssemblerTool implements org.apache.openejb.spi.A } catch (final RuntimeException e) { logger.error(e.getMessage(), e); } - } else if (preDestroy != null) { + } else if ((preDestroy = findPreDestroy(object)) != null) { logger.debug("Calling @PreDestroy on: " + className); try { preDestroy.invoke(object);