You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2014/06/30 17:36:54 UTC
[05/50] [abbrv] git commit: SLIDER-156 Utilize multiple log
directories when possible
SLIDER-156 Utilize multiple log directories when possible
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/57a9c9f8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/57a9c9f8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/57a9c9f8
Branch: refs/heads/feature/SLIDER-151_Implement_full_slider_API_in_REST_and_switch_client_to_it
Commit: 57a9c9f88d7bc41ee80320dd146244be5c3d420f
Parents: 45f5d79
Author: tedyu <yu...@gmail.com>
Authored: Sun Jun 22 17:52:20 2014 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Sun Jun 22 17:52:20 2014 -0700
----------------------------------------------------------------------
.../slider/providers/hbase/HBaseProviderService.java | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/57a9c9f8/slider-providers/hbase/slider-hbase-provider/src/main/java/org/apache/slider/providers/hbase/HBaseProviderService.java
----------------------------------------------------------------------
diff --git a/slider-providers/hbase/slider-hbase-provider/src/main/java/org/apache/slider/providers/hbase/HBaseProviderService.java b/slider-providers/hbase/slider-hbase-provider/src/main/java/org/apache/slider/providers/hbase/HBaseProviderService.java
index 5405753..a578441 100644
--- a/slider-providers/hbase/slider-hbase-provider/src/main/java/org/apache/slider/providers/hbase/HBaseProviderService.java
+++ b/slider-providers/hbase/slider-hbase-provider/src/main/java/org/apache/slider/providers/hbase/HBaseProviderService.java
@@ -60,6 +60,7 @@ import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Random;
import static org.apache.slider.server.appmaster.web.rest.RestPaths.SLIDER_PATH_PUBLISHER;
@@ -127,9 +128,16 @@ public class HBaseProviderService extends AbstractProviderService implements
// Set the environment
launcher.putEnv(SliderUtils.buildEnvMap(appComponent));
- String logDir = providerUtils.getLogdir();
- int idx = logDir.indexOf(",");
- launcher.setEnv(HBASE_LOG_DIR, idx > 0 ? logDir.substring(0, idx) : logDir);
+ String logDirs = providerUtils.getLogdir();
+ String logDir;
+ int idx = logDirs.indexOf(",");
+ if (idx > 0) {
+ // randomly choose a log dir candidate
+ String[] segments = logDirs.split(",");
+ Random rand = new Random();
+ logDir = segments[rand.nextInt(segments.length)];
+ } else logDir = logDirs;
+ launcher.setEnv(HBASE_LOG_DIR, logDir);
launcher.setEnv(PROPAGATED_CONFDIR,
ProviderUtils.convertToAppRelativePath(