You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by ar...@apache.org on 2021/03/11 05:04:58 UTC

[zookeeper] branch branch-3.7.0 updated: ZOOKEEPER-4230: Use dynamic temp folder instead of static temp folder in RestMain

This is an automated email from the ASF dual-hosted git repository.

arshad pushed a commit to branch branch-3.7.0
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/branch-3.7.0 by this push:
     new 2a88476  ZOOKEEPER-4230: Use dynamic temp folder instead of static temp folder in RestMain
2a88476 is described below

commit 2a88476bf84bcca9ab5d62404e85521b04636fd7
Author: Mukti Krishnan <mu...@gmail.com>
AuthorDate: Thu Mar 11 10:36:48 2021 +0530

    ZOOKEEPER-4230: Use dynamic temp folder instead of static temp folder in RestMain
    
    Author: Mukti <mu...@gmail.com>
    
    Reviewers: Enrico Olivelli <eo...@apache.org>, Mohammad Arshad <ar...@apache.org>
    
    Closes #1633 from MuktiKrishnan/ZOOKEEPER-4230-master
    
    (cherry picked from commit 04471b2e117a0cbe08c42b0482f0adca93494e7c)
    Signed-off-by: Mohammad Arshad <ar...@apache.org>
---
 .../src/main/java/org/apache/zookeeper/server/jersey/RestMain.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/zookeeper-contrib/zookeeper-contrib-rest/src/main/java/org/apache/zookeeper/server/jersey/RestMain.java b/zookeeper-contrib/zookeeper-contrib-rest/src/main/java/org/apache/zookeeper/server/jersey/RestMain.java
index 954ad04..209207f 100644
--- a/zookeeper-contrib/zookeeper-contrib-rest/src/main/java/org/apache/zookeeper/server/jersey/RestMain.java
+++ b/zookeeper-contrib/zookeeper-contrib-rest/src/main/java/org/apache/zookeeper/server/jersey/RestMain.java
@@ -22,6 +22,7 @@ import java.io.File;
 import java.io.IOException;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.nio.file.Files;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -53,7 +54,8 @@ public class RestMain {
        System.out.println("Starting grizzly ...");
 
        boolean useSSL = cfg.useSSL();
-       gws = new GrizzlyWebServer(cfg.getPort(), "/tmp/23cxv45345/2131xc2/", useSSL);
+       String zkRestResourcesTempPath = Files.createTempDirectory("zkRestResourcesTempPath").toFile().getCanonicalPath();
+       gws = new GrizzlyWebServer(cfg.getPort(), zkRestResourcesTempPath, useSSL);
        // BUG: Grizzly needs a doc root if you are going to register multiple adapters
 
        for (Endpoint e : cfg.getEndpoints()) {