public boolean cancelPrepareBuild( int projectGroupId, int scmRootId )
throws BuildManagerException
{
try
{
OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectGroupIsQueued( projectGroupId,
scmRootId );
if ( overallBuildQueue != null )
{
overallBuildQueue.cancelPrepareBuildTask( projectGroupId, scmRootId );
}
else
{
synchronized ( overallBuildQueues )
{
Set<Integer> keySet = overallBuildQueues.keySet();
for ( Integer key : keySet )
{
overallBuildQueue = overallBuildQueues.get( key );
PrepareBuildProjectsTask task =
(PrepareBuildProjectsTask) overallBuildQueue.getPrepareBuildTaskQueueExecutor().getCurrentTask();
if ( task != null && task.getProjectGroupId() == projectGroupId &&
task.getProjectScmRootId() == scmRootId )
{
overallBuildQueue.cancelPrepareBuildTask( projectGroupId, scmRootId );
return true;
}
}
log.error( "Project group '{}' with scm root '{}' not found in any of the builds queues.",
projectGroupId, scmRootId );