public List < String > getMasterServers ( ) { final List < String > serverList = getClusterConfiguration ( null ) . field ( SERVERS ) ; if ( serverList != null ) { // COPY AND REMOVE ANY NEW_NODE_TAG List < String > masters = new ArrayList < String > ( serverList . size ( ) ) ; for ( String s : serverList ) { if ( ! s . equals ( NEW_NODE_TAG ) ) masters . add ( s ) ; } final ROLES defRole = getDefaultServerRole ( ) ; final ODocument servers = configuration . field ( SERVERS ) ; if ( servers != null ) { for ( Iterator < String > it = masters . iterator ( ) ; it . hasNext ( ) ; ) { final String server = it . next ( ) ; final String roleAsString = servers . field ( server ) ; final ROLES role = roleAsString != null ? ROLES . valueOf ( roleAsString . toUpperCase ( Locale . ENGLISH ) ) : defRole ; if ( role != ROLES . MASTER ) it . remove ( ) ; } } return masters ; } return Collections . EMPTY_LIST ; }
Returns an ordered list of master server . The first in the list is the first found in configuration . This is used to determine the cluster leader .