/*
 * Licensed to the University of California, Berkeley under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for additional information regarding
 * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License. You may obtain a
 * copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package tachyon.worker.block;

import java.net.InetSocketAddress;

import tachyon.Constants;
import tachyon.conf.TachyonConf;
import tachyon.util.NetworkUtils;

public final class BlockWorkerUtils {

  /**
   * Gets the Tachyon master address from the configuration
   *
   * @return the InetSocketAddress of the master
   */
  public static InetSocketAddress getMasterAddress(TachyonConf conf) {
    String masterHostname =
        conf.get(Constants.MASTER_HOSTNAME, NetworkUtils.getLocalHostName(conf));
    int masterPort = conf.getInt(Constants.MASTER_PORT, Constants.DEFAULT_MASTER_PORT);
    return new InetSocketAddress(masterHostname, masterPort);
  }

  /**
   * Helper method to get the {@link java.net.InetSocketAddress} of the worker.
   * 
   * @return the worker's address
   */
  public static InetSocketAddress getWorkerAddress(TachyonConf conf) {
    String workerHostname = NetworkUtils.getLocalHostName(conf);
    int workerPort = conf.getInt(Constants.WORKER_PORT, Constants.DEFAULT_WORKER_PORT);
    return new InetSocketAddress(workerHostname, workerPort);
  }
}

@@ -947,16 +947,66 @@
 Utils;%0A%0A
+/**%0A * Utils for tachyon.worker.block package%0A */%0A
 public f
@@ -1107,16 +1107,62 @@
 on%0A   *%0A
+   * @param conf the configuration of Tachyon%0A
    * @re
@@ -1636,16 +1636,62 @@
 .%0A   * %0A
+   * @param conf the configuration of Tachyon%0A
    * @re

fix comments of BlockWorkerUtils