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 042810a19ed..e779f933d9c 100644 --- a/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java +++ b/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java @@ -429,14 +429,14 @@ public static void main(String[] args) throws ParserConfigurationException, SAXE + File.separator + bootstrap.getUseVersion() + File.separator + "arthas"); if (!specialVersionDir.exists()) { // try to download arthas from remote server. - DownloadUtils.downArthasPackaging(bootstrap.getRepoMirror(), bootstrap.isuseHttp(), + DownloadUtils.downArthasPackaging(bootstrap.getRepoMirror(), bootstrap.isUseHttp(), bootstrap.getUseVersion(), ARTHAS_LIB_DIR.getAbsolutePath()); } verifyArthasHome(specialVersionDir.getAbsolutePath()); arthasHomeDir = specialVersionDir; } - // Try set the directory where arthas-boot.jar is located to arhtas home + // Try set the directory where arthas-boot.jar is located to arthas home if (arthasHomeDir == null) { CodeSource codeSource = Bootstrap.class.getProtectionDomain().getCodeSource(); if (codeSource != null) { @@ -470,16 +470,16 @@ public static void main(String[] args) throws ParserConfigurationException, SAXE List versionList = listNames(ARTHAS_LIB_DIR); Collections.sort(versionList); - String localLastestVersion = null; + String localLatestVersion = null; if (!versionList.isEmpty()) { - localLastestVersion = versionList.get(versionList.size() - 1); + localLatestVersion = versionList.get(versionList.size() - 1); } - String remoteLastestVersion = DownloadUtils.readLatestReleaseVersion(); + String remoteLatestVersion = DownloadUtils.readLatestReleaseVersion(); boolean needDownload = false; - if (localLastestVersion == null) { - if (remoteLastestVersion == null) { + if (localLatestVersion == null) { + if (remoteLatestVersion == null) { // exit AnsiLog.error("Can not find Arthas under local: {} and remote repo mirror: {}", ARTHAS_LIB_DIR, bootstrap.getRepoMirror()); @@ -490,23 +490,23 @@ public static void main(String[] args) throws ParserConfigurationException, SAXE needDownload = true; } } else { - if (remoteLastestVersion != null) { - if (localLastestVersion.compareTo(remoteLastestVersion) < 0) { - AnsiLog.info("local lastest version: {}, remote lastest version: {}, try to download from remote.", - localLastestVersion, remoteLastestVersion); + if (remoteLatestVersion != null) { + if (localLatestVersion.compareTo(remoteLatestVersion) < 0) { + AnsiLog.info("local latest version: {}, remote latest version: {}, try to download from remote.", + localLatestVersion, remoteLatestVersion); needDownload = true; } } } if (needDownload) { // try to download arthas from remote server. - DownloadUtils.downArthasPackaging(bootstrap.getRepoMirror(), bootstrap.isuseHttp(), - remoteLastestVersion, ARTHAS_LIB_DIR.getAbsolutePath()); - localLastestVersion = remoteLastestVersion; + DownloadUtils.downArthasPackaging(bootstrap.getRepoMirror(), bootstrap.isUseHttp(), + remoteLatestVersion, ARTHAS_LIB_DIR.getAbsolutePath()); + localLatestVersion = remoteLatestVersion; } // get the latest version - arthasHomeDir = new File(ARTHAS_LIB_DIR, localLastestVersion + File.separator + "arthas"); + arthasHomeDir = new File(ARTHAS_LIB_DIR, localLatestVersion + File.separator + "arthas"); } verifyArthasHome(arthasHomeDir.getAbsolutePath()); @@ -785,7 +785,7 @@ public String getRepoMirror() { return repoMirror; } - public boolean isuseHttp() { + public boolean isUseHttp() { return useHttp; } diff --git a/core/src/main/java/com/taobao/arthas/core/command/basic1000/HistoryCommand.java b/core/src/main/java/com/taobao/arthas/core/command/basic1000/HistoryCommand.java index ad50157addc..d2f690cebc3 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/basic1000/HistoryCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/basic1000/HistoryCommand.java @@ -39,7 +39,7 @@ public void setClear(boolean clear) { } @Argument(index = 0, argName = "n", required = false) - @Description("how many history commnads to display") + @Description("how many history commands to display") public void setNumber(int n) { this.n = n; } diff --git a/core/src/main/java/com/taobao/arthas/core/command/basic1000/JFRCommand.java b/core/src/main/java/com/taobao/arthas/core/command/basic1000/JFRCommand.java index f615cbf9fd9..efa3a0cc4ab 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/basic1000/JFRCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/basic1000/JFRCommand.java @@ -322,7 +322,7 @@ public void process(CommandProcess process) { try { r.setDestination(Paths.get(getFilename())); } catch (IOException e) { - process.end(-1, "Failed to stop" + r.getName() + ". Could not set destination for " + filename + "to file" + e.getMessage()); + process.end(-1, "Failed to stop " + r.getName() + ". Could not set destination for " + filename + "to file" + e.getMessage()); } r.stop(); @@ -353,7 +353,7 @@ public long parseSize(String s) throws Exception { try { return Long.parseLong(s); } catch (Exception e) { - throw new NumberFormatException("'" + s + "' is not a valid size. Shoule be numeric value followed by a unit, i.e. 20M. Valid units k, M, G"); + throw new NumberFormatException("'" + s + "' is not a valid size. Should be numeric value followed by a unit, i.e. 20M. Valid units k, M, G"); } } } diff --git a/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java b/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java index 63b68c55027..5ee8564b0f9 100644 --- a/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java +++ b/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java @@ -186,9 +186,15 @@ public static DefaultFullHttpResponse directView(File dir, String path, FullHttp } finally { IOUtils.close(fileInputStream); } - ctx.write(fullResp); - ChannelFuture future = ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); - future.addListener(ChannelFutureListener.CLOSE); + ChannelFuture channelFuture = ctx.writeAndFlush(fullResp); + channelFuture.addListener((ChannelFutureListener) future -> { + if (future.isSuccess()) { + ChannelFuture lastContentFuture = ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); + lastContentFuture.addListener(ChannelFutureListener.CLOSE); + } else { + future.channel().close(); + } + }); return fullResp; } logger.info("file {} size bigger than {}, send by future.",file.getName(), MIN_NETTY_DIRECT_SEND_SIZE); diff --git a/core/src/main/java/one/profiler/AsyncProfiler.java b/core/src/main/java/one/profiler/AsyncProfiler.java index 9a1514388c3..d077f49e498 100644 --- a/core/src/main/java/one/profiler/AsyncProfiler.java +++ b/core/src/main/java/one/profiler/AsyncProfiler.java @@ -1,17 +1,6 @@ /* - * Copyright 2018 Andrei Pangin - * - * Licensed 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. + * Copyright The async-profiler authors + * SPDX-License-Identifier: Apache-2.0 */ package one.profiler; @@ -283,4 +272,4 @@ private void filterThread(Thread thread, boolean enable) { private native String execute0(String command) throws IllegalArgumentException, IllegalStateException, IOException; private native void filterThread0(Thread thread, boolean enable); -} +} \ No newline at end of file diff --git a/core/src/main/java/one/profiler/AsyncProfilerMXBean.java b/core/src/main/java/one/profiler/AsyncProfilerMXBean.java index 90abf830c7a..5210c647b09 100644 --- a/core/src/main/java/one/profiler/AsyncProfilerMXBean.java +++ b/core/src/main/java/one/profiler/AsyncProfilerMXBean.java @@ -1,17 +1,6 @@ /* - * Copyright 2018 Andrei Pangin - * - * Licensed 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. + * Copyright The async-profiler authors + * SPDX-License-Identifier: Apache-2.0 */ package one.profiler; @@ -40,4 +29,4 @@ public interface AsyncProfilerMXBean { String dumpCollapsed(Counter counter); String dumpTraces(int maxTraces); String dumpFlat(int maxMethods); -} +} \ No newline at end of file diff --git a/core/src/main/java/one/profiler/Counter.java b/core/src/main/java/one/profiler/Counter.java index 489053b7290..0d0ec1160cc 100644 --- a/core/src/main/java/one/profiler/Counter.java +++ b/core/src/main/java/one/profiler/Counter.java @@ -1,17 +1,6 @@ /* - * Copyright 2018 Andrei Pangin - * - * Licensed 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. + * Copyright The async-profiler authors + * SPDX-License-Identifier: Apache-2.0 */ package one.profiler; @@ -22,4 +11,4 @@ public enum Counter { SAMPLES, TOTAL -} +} \ No newline at end of file diff --git a/core/src/main/java/one/profiler/Events.java b/core/src/main/java/one/profiler/Events.java index 1731122c725..677c0e4140f 100644 --- a/core/src/main/java/one/profiler/Events.java +++ b/core/src/main/java/one/profiler/Events.java @@ -1,17 +1,6 @@ /* - * Copyright 2018 Andrei Pangin - * - * Licensed 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. + * Copyright The async-profiler authors + * SPDX-License-Identifier: Apache-2.0 */ package one.profiler; @@ -24,5 +13,6 @@ public class Events { public static final String ALLOC = "alloc"; public static final String LOCK = "lock"; public static final String WALL = "wall"; + public static final String CTIMER = "ctimer"; public static final String ITIMER = "itimer"; -} +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 828e3f157c0..f6d2061162f 100644 --- a/pom.xml +++ b/pom.xml @@ -88,7 +88,7 @@ 3.0.0 2020-09-27T15:10:43Z 1.0.0 - 4.1.112.Final + 4.1.113.Final