@Override
  public String getRackName(final Container container) {
    final String hostName = container.getNodeId().getHost();

    // the rack name comes as part of the host name, e.g.
    // <rackName>-<hostNumber>
    // we perform some checks just in case it doesn't
    String rackName = null;
    if (hostName != null) {
      final String[] rackNameAndNumber = hostName.split("-");
      if (rackNameAndNumber.length == 2) {
        rackName = rackNameAndNumber[0];
      } else {
        LOG.log(Level.WARNING, "Could not get information from the rack name, should use the default");
      }
    }

    return rackName;
  }
@ Override public String getRackName ( final Container container ) { final String hostName = container . getNodeId ( ) . getHost ( ) ; String rackName = null ; if ( hostName != null ) { final String [ ] rackNameAndNumber = hostName . split ( "-" ) ; if ( rackNameAndNumber . length == 2 ) { rackName = rackNameAndNumber [ 0 ] ; } else { LOG . log ( Level . WARNING , "Could not get information from the rack name, should use the default" ) ; } } return rackName ; }
@see RackNameFormatter#getRackName(Container)