List<BuildProjectTask> tasks;
List<CheckOutTask> checkoutTasks;
synchronized ( overallBuildQueues )
{
OverallBuildQueue overallBuildQueue = overallBuildQueues.get( overallBuildQueueId );
if ( overallBuildQueue.getName().equals( ConfigurationService.DEFAULT_BUILD_QUEUE_NAME ) )
{
throw new BuildManagerException( "Cannot remove default build queue." );
}
try
{
if ( overallBuildQueue.getBuildTaskQueueExecutor().getCurrentTask() != null ||
overallBuildQueue.getCheckoutTaskQueueExecutor().getCurrentTask() != null )
{
throw new BuildManagerException( "Cannot remove build queue. A task is currently executing." );
}
tasks = overallBuildQueue.getProjectsInBuildQueue();
checkoutTasks = overallBuildQueue.getProjectsInCheckoutQueue();
overallBuildQueue.getBuildQueue().removeAll( tasks );
overallBuildQueue.getCheckoutQueue().removeAll( checkoutTasks );
( (ParallelBuildsThreadedTaskQueueExecutor) overallBuildQueue.getBuildTaskQueueExecutor() ).stop();
( (ParallelBuildsThreadedTaskQueueExecutor) overallBuildQueue.getCheckoutTaskQueueExecutor() ).stop();
container.release( overallBuildQueue );
}
catch ( TaskQueueException e )
{
throw new BuildManagerException(