try
{
if ( overallDistributedBuildQueue.getDistributedBuildTaskQueueExecutor().getCurrentTask() != null )
{
log.error( "Unable to remove build agent because it is currently being used" );
throw new ContinuumException( "Unable to remove build agent because it is currently being used" );
}
tasks = overallDistributedBuildQueue.getProjectsInQueue();
overallDistributedBuildQueue.getDistributedBuildQueue().removeAll( tasks );
( (ThreadedDistributedBuildTaskQueueExecutor) overallDistributedBuildQueue.getDistributedBuildTaskQueueExecutor() ).stop();
container.release( overallDistributedBuildQueue );
overallDistributedBuildQueues.remove( buildAgentUrl );
log.info( "remove distributed build queue for build agent '" + buildAgentUrl + "'" );
}
catch ( TaskQueueException e )
{
log.error( "Error occurred while removing build agent " + buildAgentUrl, e );
throw new ContinuumException( "Error occurred while removing build agent " + buildAgentUrl, e );
}
catch ( ComponentLifecycleException e )
{
log.error( "Error occurred while removing build agent " + buildAgentUrl, e );
throw new ContinuumException( "Error occurred while removing build agent " + buildAgentUrl, e );
}
catch ( StoppingException e )
{
log.error( "Error occurred while removing build agent " + buildAgentUrl, e );
throw new ContinuumException( "Error occurred while removing build agent " + buildAgentUrl, e );
}
}
}
}