gets the next available port starting at the lowest number . this is the preferred method to use . the port return is immediately marked in use and does n't rely on the caller actually opening the port . concode_field_sep int MIN_PORT_NUMBER concode_elem_sep Logger LOG concode_elem_sep ServerSocket LOCK concode_elem_sep AtomicInteger currentMinPort concode_elem_sep int MAX_PORT_NUMBER concode_field_sep boolean available concode_elem_sep void run
int function ( ) { final int loc0 = getNextAvailable ( currentMinPort . get ( ) ) ; currentMinPort . set ( loc0 + 1 ) ; return loc0 ; }