public void addToStartWeightList ( IServletConfig sc ) { // we haven't started sorting the startup weights yet so just ignore. It // will be added later. if ( this . sortedServletConfigs == null ) return ; int size = this . sortedServletConfigs . size ( ) ; int pos = 0 ; boolean added = false ; if ( size == 0 || ! sc . isLoadOnStartup ( ) ) sortedServletConfigs . add ( sc ) ; else { // remove the current entry if it was already added if ( sc . isAddedToLoadOnStartup ( ) && sc . isWeightChanged ( ) ) sortedServletConfigs . remove ( sc ) ; int value = sc . getStartUpWeight ( ) ; for ( IServletConfig curServletConfig : sortedServletConfigs ) { int curStartupWeight = curServletConfig . getStartUpWeight ( ) ; if ( value < curStartupWeight || ! curServletConfig . isLoadOnStartup ( ) ) { sortedServletConfigs . add ( pos , sc ) ; added = true ; break ; } pos ++ ; } if ( ! added ) sortedServletConfigs . add ( sc ) ; } sc . setAddedToLoadOnStartup ( true ) ; }
Method addToStartWeightList .