diff --git a/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java b/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java
index a9023c57f..2bd35855b 100644
--- a/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java
+++ b/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java
@@ -43,6 +43,8 @@ public class Bootstrap {
private static final int DEFAULT_TELNET_PORT = 3658;
private static final int DEFAULT_HTTP_PORT = 8563;
private static final String DEFAULT_TARGET_IP = "127.0.0.1";
+ private static final File ARTHAS_LIB_DIR = new File(
+ System.getProperty("user.home") + File.separator + ".arthas" + File.separator + "lib");
private boolean help = false;
@@ -258,6 +260,11 @@ public class Bootstrap {
// try to find from ~/.arthas/lib
File specialVersionDir = new File(System.getProperty("user.home"), ".arthas" + File.separator + "lib"
+ File.separator + bootStrap.getUseVersion() + File.separator + "arthas");
+ if (!specialVersionDir.exists()) {
+ // try to download arthas from remote server.
+ DownloadUtils.downArthasPackaging(bootStrap.getRepoMirror(), bootStrap.isuseHttp(),
+ bootStrap.getUseVersion(), ARTHAS_LIB_DIR.getAbsolutePath());
+ }
verifyArthasHome(specialVersionDir.getAbsolutePath());
arthasHomeDir = specialVersionDir;
}
@@ -279,9 +286,7 @@ public class Bootstrap {
// try to download from remote server
if (arthasHomeDir == null) {
- File arthasLibDir = new File(
- System.getProperty("user.home") + File.separator + ".arthas" + File.separator + "lib");
- arthasLibDir.mkdirs();
+ ARTHAS_LIB_DIR.mkdirs();
/**
*
@@ -290,7 +295,7 @@ public class Bootstrap {
* 3. compare two version
*
*/
- List versionList = listNames(arthasLibDir);
+ List versionList = listNames(ARTHAS_LIB_DIR);
Collections.sort(versionList);
String localLastestVersion = null;
@@ -305,7 +310,7 @@ public class Bootstrap {
if (localLastestVersion == null) {
if (remoteLastestVersion == null) {
// exit
- AnsiLog.error("Can not find Arthas under local: {} and remote: {}", arthasLibDir,
+ AnsiLog.error("Can not find Arthas under local: {} and remote: {}", ARTHAS_LIB_DIR,
bootStrap.getRepoMirror());
System.exit(1);
} else {
@@ -323,12 +328,12 @@ public class Bootstrap {
if (needDownload) {
// try to download arthas from remote server.
DownloadUtils.downArthasPackaging(bootStrap.getRepoMirror(), bootStrap.isuseHttp(),
- remoteLastestVersion, arthasLibDir.getAbsolutePath());
+ remoteLastestVersion, ARTHAS_LIB_DIR.getAbsolutePath());
localLastestVersion = remoteLastestVersion;
}
// get the latest version
- arthasHomeDir = new File(arthasLibDir, localLastestVersion + File.separator + "arthas");
+ arthasHomeDir = new File(ARTHAS_LIB_DIR, localLastestVersion + File.separator + "arthas");
}
verifyArthasHome(arthasHomeDir.getAbsolutePath());
diff --git a/boot/src/main/java/com/taobao/arthas/boot/DownloadUtils.java b/boot/src/main/java/com/taobao/arthas/boot/DownloadUtils.java
index 8e20bdebc..5ad8b7f21 100644
--- a/boot/src/main/java/com/taobao/arthas/boot/DownloadUtils.java
+++ b/boot/src/main/java/com/taobao/arthas/boot/DownloadUtils.java
@@ -134,13 +134,14 @@ public class DownloadUtils {
long lastPrintTime = System.currentTimeMillis();
while ((count = in.read(data, 0, 1024 * 1024)) != -1) {
totalCount += count;
- long now = System.currentTimeMillis();
- if (now - lastPrintTime > 3000) {
- AnsiLog.info("File size: {}, Downloaded size: {}, Downloading ...", formatFileSize(fileSize),
- formatFileSize(totalCount));
- lastPrintTime = now;
+ if (printProgress) {
+ long now = System.currentTimeMillis();
+ if (now - lastPrintTime > 1000) {
+ AnsiLog.info("File size: {}, downloaded size: {}, downloading ...", formatFileSize(fileSize),
+ formatFileSize(totalCount));
+ lastPrintTime = now;
+ }
}
-
fout.write(data, 0, count);
}
} catch (javax.net.ssl.SSLException e) {
diff --git a/common/src/main/java/com/taobao/arthas/common/IOUtils.java b/common/src/main/java/com/taobao/arthas/common/IOUtils.java
index a68ae9737..8d5b74602 100644
--- a/common/src/main/java/com/taobao/arthas/common/IOUtils.java
+++ b/common/src/main/java/com/taobao/arthas/common/IOUtils.java
@@ -72,7 +72,7 @@ public class IOUtils {
File file = new File(zipFile);
ZipFile zip = null;
try {
- int BUFFER = 2048;
+ int BUFFER = 1024 * 8;
zip = new ZipFile(file);
String newPath = extractFolder;