void createInitialExecutionVertices ( final int initalNumberOfVertices ) throws GraphConversionException { // If the requested number of group vertices does not change, do nothing if ( initalNumberOfVertices == this . getCurrentNumberOfGroupMembers ( ) ) { return ; } // Make sure the method is only called for the initial setup of the graph if ( this . getCurrentNumberOfGroupMembers ( ) != 1 ) { throw new IllegalStateException ( "This method can only be called for the initial setup of the execution graph" ) ; } // If the number of group vertices is user defined, prevent overwriting if ( this . userDefinedNumberOfMembers != - 1 ) { if ( this . userDefinedNumberOfMembers == getCurrentNumberOfGroupMembers ( ) ) { // Note that // this.userDefinedNumberOfMembers // is final and requires no // locking! throw new GraphConversionException ( "Cannot overwrite user defined number of group members" ) ; } } // Make sure the value of newNumber is valid // TODO: Move these checks to some other place /* * if (this.getMinimumNumberOfGroupMember() < 1) { * throw new GraphConversionException("The minimum number of members is below 1 for group vertex " * + this.getName()); * } * if ((this.getMaximumNumberOfGroupMembers() != -1) * && (this.getMaximumNumberOfGroupMembers() < this.getMinimumNumberOfGroupMember())) { * throw new GraphConversionException( * "The maximum number of members is smaller than the minimum for group vertex " + this.getName()); * } */ if ( initalNumberOfVertices < this . getMinimumNumberOfGroupMember ( ) ) { throw new GraphConversionException ( "Number of members must be at least " + this . getMinimumNumberOfGroupMember ( ) ) ; } if ( ( this . getMaximumNumberOfGroupMembers ( ) != - 1 ) && ( initalNumberOfVertices > this . getMaximumNumberOfGroupMembers ( ) ) ) { throw new GraphConversionException ( "Number of members cannot exceed " + this . getMaximumNumberOfGroupMembers ( ) ) ; } final ExecutionVertex originalVertex = this . getGroupMember ( 0 ) ; int currentNumberOfExecutionVertices = this . getCurrentNumberOfGroupMembers ( ) ; while ( currentNumberOfExecutionVertices ++ < initalNumberOfVertices ) { final ExecutionVertex vertex = originalVertex . splitVertex ( ) ; vertex . setAllocatedResource ( new AllocatedResource ( DummyInstance . createDummyInstance ( this . instanceType ) , this . instanceType , null ) ) ; this . groupMembers . add ( vertex ) ; } // Update the index and size information attached to the vertices int index = 0 ; final Iterator < ExecutionVertex > it = this . groupMembers . iterator ( ) ; while ( it . hasNext ( ) ) { final ExecutionVertex vertex = it . next ( ) ; vertex . setIndexInVertexGroup ( index ++ ) ; } }
Creates the initial execution vertices managed by this group vertex .