From 773bbc1b92ce257fecf155f95c2e477c1b60c784 Mon Sep 17 00:00:00 2001 From: Haoyuan Li Date: Wed, 1 Apr 2015 16:55:51 -0700 Subject: [PATCH] remove the deprecated constructor in TachyonWorker. --- .../java/tachyon/worker/TachyonWorker.java | 37 ------------------- .../LocalTachyonClusterMultiMaster.java | 16 +++++--- 2 files changed, 10 insertions(+), 43 deletions(-) diff --git a/core/src/main/java/tachyon/worker/TachyonWorker.java b/core/src/main/java/tachyon/worker/TachyonWorker.java index 7bf59c992bb9..4d480fa2b30f 100644 --- a/core/src/main/java/tachyon/worker/TachyonWorker.java +++ b/core/src/main/java/tachyon/worker/TachyonWorker.java @@ -53,43 +53,6 @@ public class TachyonWorker implements Runnable { private static final Logger LOG = LoggerFactory.getLogger(Constants.LOGGER_TYPE); - /** - * Create a new TachyonWorker - * - * @param masterAddress The TachyonMaster's address. e.g., localhost - * @param masterPort The TachyonMaster's port. e.g., 19998 - * @param workerPort This TachyonWorker's port. e.g., 29998 - * @param dataPort This TachyonWorker's data server's port - * @param minWorkerThreads The min number of worker threads used in TThreadPoolServer - * @param maxWorkerThreads The max number of worker threads used in TThreadPoolServer - * @param tachyonConf The instance of {@link tachyon.conf.TachyonConf} to used by Worker. - * @return The new TachyonWorker - */ - public static synchronized TachyonWorker createWorker(String masterAddress, int masterPort, - int workerPort, int dataPort, int minWorkerThreads, int maxWorkerThreads, - TachyonConf tachyonConf) { - if (masterAddress != null) { - tachyonConf.set(Constants.MASTER_ADDRESS, masterAddress); - } - if (masterPort >= 0) { - tachyonConf.set(Constants.MASTER_PORT, masterPort + ""); - } - if (workerPort >= 0) { - tachyonConf.set(Constants.WORKER_PORT, workerPort + ""); - } - if (dataPort >= 0) { - tachyonConf.set(Constants.WORKER_DATA_PORT, dataPort + ""); - } - if (minWorkerThreads > 0) { - tachyonConf.set(Constants.WORKER_MIN_WORKER_THREADS, minWorkerThreads + ""); - } - if (maxWorkerThreads > 0) { - tachyonConf.set(Constants.WORKER_MAX_WORKER_THREADS, maxWorkerThreads + ""); - } - - return createWorker(tachyonConf); - } - /** * Create a new TachyonWorker * diff --git a/core/src/test/java/tachyon/master/LocalTachyonClusterMultiMaster.java b/core/src/test/java/tachyon/master/LocalTachyonClusterMultiMaster.java index b314dcbc1cf6..9a3a50e39e04 100644 --- a/core/src/test/java/tachyon/master/LocalTachyonClusterMultiMaster.java +++ b/core/src/test/java/tachyon/master/LocalTachyonClusterMultiMaster.java @@ -31,7 +31,6 @@ import tachyon.client.TachyonFS; import tachyon.conf.TachyonConf; import tachyon.util.CommonUtils; -import tachyon.util.NetworkUtils; import tachyon.worker.TachyonWorker; /** @@ -184,8 +183,8 @@ public void start() throws IOException { mWorkerConf.set("tachyon.worker.hierarchystore.level0.dirs.path", mTachyonHome + "/ramdisk"); mWorkerConf.set("tachyon.worker.hierarchystore.level0.dirs.quota", mWorkerCapacityBytes + ""); - // Since tests are always running on a single host keep the resolution timeout low as otherwise people - // running with strange network configurations will see very slow tests + // Since tests are always running on a single host keep the resolution timeout low as otherwise + // people running with strange network configurations will see very slow tests mWorkerConf.set(Constants.HOST_RESOLUTION_TIMEOUT_MS, "250"); for (int level = 1; level < maxLevel; level ++) { @@ -199,9 +198,14 @@ public void start() throws IOException { newPath.substring(0, newPath.length() - 1)); } - mWorker = - TachyonWorker.createWorker(mCuratorServer.getConnectString().split(":")[0], - mCuratorServer.getPort(), 0, 0, 1, 100, mWorkerConf); + mWorkerConf.set(Constants.MASTER_ADDRESS, mCuratorServer.getConnectString().split(":")[0]); + mWorkerConf.set(Constants.MASTER_PORT, mCuratorServer.getPort() + ""); + mWorkerConf.set(Constants.WORKER_PORT, "0"); + mWorkerConf.set(Constants.WORKER_DATA_PORT, "0"); + mWorkerConf.set(Constants.WORKER_MIN_WORKER_THREADS, "1"); + mWorkerConf.set(Constants.WORKER_MAX_WORKER_THREADS, "100"); + + mWorker = TachyonWorker.createWorker(mWorkerConf); Runnable runWorker = new Runnable() { @Override public void run() {