Browse Source

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
master
Peter Donald 24 years ago
parent
commit
e5e10d6b06
2 changed files with 2 additions and 63 deletions
  1. +2
    -15
      proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java
  2. +0
    -48
      proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java

+ 2
- 15
proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java View File

@@ -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 );
}
}
}


+ 0
- 48
proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java View File

@@ -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 );
}
}
}
}

Loading…
Cancel
Save