public static ServerName getServerNameFromWALDirectoryName(Path logFile) {
    String logDirName = logFile.getParent().getName();
    // We were passed the directory and not a file in it.
    if (logDirName.equals(HConstants.HREGION_LOGDIR_NAME)) {
      logDirName = logFile.getName();
    }
    ServerName serverName = null;
    if (logDirName.endsWith(SPLITTING_EXT)) {
      logDirName = logDirName.substring(0, logDirName.length() - SPLITTING_EXT.length());
    }
    try {
      serverName = ServerName.parseServerName(logDirName);
    } catch (IllegalArgumentException | IllegalStateException ex) {
      serverName = null;
      LOG.warn("Cannot parse a server name from path={}", logFile, ex);
    }
    if (serverName != null && serverName.getStartCode() < 0) {
      LOG.warn("Invalid log file path={}, start code {} is less than 0", logFile,
        serverName.getStartCode());
      serverName = null;
    }
    return serverName;
  }
This function returns region server name from a log file name which is in one of the following
formats:
<ul>
<li>hdfs://&lt;name node&gt;/hbase/.logs/&lt;server name&gt;-splitting/...</li>
<li>hdfs://&lt;name node&gt;/hbase/.logs/&lt;server name&gt;/...</li>
</ul>
@return null if the passed in logFile isn't a valid WAL file path
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractFSWALProvider.java