private void incrementPortsIfDuplicateName ( String configName , ProcessConfigBean config ) { int startedCount = getNumberOfInstancesStarted ( configName ) ; int debugPort = config . getDebugPort ( ) ; if ( debugPort != - 1 ) { config . setDebugPort ( debugPort + startedCount ) ; } int remotingPort = config . getRemotingPort ( ) ; if ( remotingPort != - 1 ) { config . setRemotingPort ( remotingPort + startedCount ) ; } }
If we already have an instance of a process with this name auto increment ports to avoid a conflict