From e5e10d6b06c92dda8031ce23a51fb6becc95c4e5 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Sun, 30 Dec 2001 06:36:48 +0000 Subject: [PATCH] Remove the initialize and dispose stages in the lifecycle of a task as they no longer are needed given task execution occurs in a single pass. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270459 13f79535-47bb-0310-9956-ffa450edef68 --- .../executor/AspectAwareExecutor.java | 17 +------ .../components/executor/DefaultExecutor.java | 48 ------------------- 2 files changed, 2 insertions(+), 63 deletions(-) diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java index 802970c33..c45c6483b 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java @@ -29,15 +29,8 @@ public class AspectAwareExecutor private static final Resources REZ = ResourceManager.getPackageResources( AspectAwareExecutor.class ); - private final static Parameters EMPTY_PARAMETERS; private final static Configuration[] EMPTY_ELEMENTS = new Configuration[ 0 ]; - static - { - EMPTY_PARAMETERS = new Parameters(); - EMPTY_PARAMETERS.makeReadOnly(); - } - private AspectManager m_aspectManager; /** @@ -95,16 +88,10 @@ public class AspectAwareExecutor getAspectManager().preConfigure( taskModel ); doConfigure( task, taskModel, frame.getContext() ); - debug( "initializing.notice" ); - doInitialize( task, taskModel ); - debug( "executing.notice" ); getAspectManager().preExecute(); doExecute( taskModel, task ); - - debug( "disposing.notice" ); getAspectManager().preDestroy(); - doDispose( task, taskModel ); } protected void doExecute( final Configuration taskModel, final Task task ) @@ -152,7 +139,7 @@ public class AspectAwareExecutor final ArrayList elementList = (ArrayList)elementMap.remove( names[ i ] ); Parameters parameters = (Parameters)parameterMap.remove( names[ i ] ); - if( null == parameters ) parameters = EMPTY_PARAMETERS; + if( null == parameters ) parameters = Parameters.EMPTY_PARAMETERS; Configuration[] elements = null; if( null == elementList ) @@ -206,7 +193,7 @@ public class AspectAwareExecutor final Configuration[] elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); - unusedSetting( namespace, EMPTY_PARAMETERS, elements ); + unusedSetting( namespace, Parameters.EMPTY_PARAMETERS, elements ); } } } diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java index c1db56f0d..f18d2e03d 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java @@ -67,14 +67,8 @@ public class DefaultExecutor debug( "configuring.notice" ); doConfigure( task, taskModel, frame.getContext() ); - debug( "initializing.notice" ); - doInitialize( task, taskModel ); - debug( "executing.notice" ); task.execute(); - - debug( "disposing.notice" ); - doDispose( task, taskModel ); } protected final void debug( final String key ) @@ -167,27 +161,6 @@ public class DefaultExecutor } } - protected final void doDispose( final Task task, final Configuration taskModel ) - throws TaskException - { - if( task instanceof Disposable ) - { - try - { - ( (Disposable)task ).dispose(); - } - catch( final Throwable throwable ) - { - final String message = - REZ.getString( "dispose.error", - taskModel.getName(), - taskModel.getLocation(), - throwable.getMessage() ); - throw new TaskException( message, throwable ); - } - } - } - protected final void doLogEnabled( final Task task, final Configuration taskModel, final Logger logger ) @@ -210,25 +183,4 @@ public class DefaultExecutor } } } - - protected final void doInitialize( final Task task, final Configuration taskModel ) - throws TaskException - { - if( task instanceof Initializable ) - { - try - { - ( (Initializable)task ).initialize(); - } - catch( final Throwable throwable ) - { - final String message = - REZ.getString( "init.error", - taskModel.getName(), - taskModel.getLocation(), - throwable.getMessage() ); - throw new TaskException( message, throwable ); - } - } - } }