Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2010, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
 package org.jboss.as.domain.controller.plan;
 
 import static org.jboss.as.domain.controller.DomainControllerMessages.MESSAGES;
 
 import java.util.Set;
 
Policy that controls whether concurrently executing updates to server groups can proceed. Acts a parent to the ServerUpdatePolicy that controls each concurrently executing server group.

Author(s):
Brian Stansberry
 
     private final Set<Stringgroups = new HashSet<String>();
     private int responseCount;
     private boolean failed;

    
Creates a new ConcurrentGroupServerUpdatePolicy.

Parameters:
predecessor the policy for a set of server group updates that were updated prior to this set. May be null if there was no previous set
groups the names of the server groups that will be concurrently updated. Cannot be null
 
                                       final Set<Stringgroups) {
         this. = predecessor;
         this..addAll(groups);
     }

    
Check from another ConcurrentGroupServerUpdatePolicy whose plans are meant to execute once this policy's plans are successfully completed.

Returns:
true if the successor can proceed
 
     private boolean canSuccessorProceed() {
 
         if ( != null && !.canSuccessorProceed()) {
             return false;
         }
 
         synchronized (this) {
             while ( < .size()) {
                 try {
                     wait();
                 } catch (InterruptedException e) {
                     Thread.currentThread().interrupt();
                     return false;
                 }
             }
             return !;
         }
     }

    
Check from a child ServerUpdatePolicy as to whether it can proceed.

Returns:
true if the child policy can proceed
 
     public boolean canChildProceed() {
         return  == null || .canSuccessorProceed();
     }

    
Records the result of updating a server group.

Parameters:
serverGroup the server group's name. Cannot be null
failed true if the server group update failed; false if it succeeded
    public void recordServerGroupResult(final String serverGroupfinal boolean failed) {
        synchronized (this) {
            if (.contains(serverGroup)) {
                ++;
                if (failed) {
                    this. = true;
                }
                ..tracef("Recorded group result for '%s': failed = %s",
                        serverGroupfailed);
                notifyAll();
            }
            else {
                throw .unknownServerGroup(serverGroup);
            }
        }
    }
New to GrepCode? Check out our FAQ X