18 Star 97 Fork 24

beifengtz / VmConsole-Api

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

VmConsole-Api

🔨VmConsole-Api是一个jvm虚拟机性能监控API,将oracle jdk提供的tools.jar包进行了功能拓展,对一些监控命令结果进行了封装,你可以方便地从对象中读取每一个参数和结果。该类库并不是简单地使用运行时exec()调用jps、jstat、jstack等命令,而是从底层深度拓展而来,所以你不需要配置java环境变量就可以通过Java代码对虚拟机进行监控。

说明:本工具API适用于jdk8及以上(jdk7以下部分功能可能会出错),虚拟机必须是HotSpot

本项目遵守Apache开源协议,核心代码由本人根据jdk源码拓展或改造而来,无模仿或抄袭。

如何使用

我已将核心依赖库打包生成了一个jar包(3MB左右),你只需要将jar包导入到项目就可以直接使用其中的类,无需导入任何其他包。

在pom.xml中引入如下依赖(以下是最新版本):

<dependency>
  <groupId>com.github.tzfun</groupId>
  <artifactId>vmconsole</artifactId>
  <version>1.1.0</version>
  <classifier>jar-with-dependencies</classifier>
</dependency>

使用示例:

import beifengtz.vmconsole.JpsCmd;
import beifengtz.vmconsole.entity.jps.JpsResult;

import java.util.List;

public class JpsTest {
    public static void main(String[] args) throws Exception{
        //  获取本地虚拟机所有虚拟机进程id
        List<JpsResult> jpsResult1 = JpsCmd.quit();
        //  获取本地虚拟机所有虚拟机进程id,同时获取虚拟机参数
        List<JpsResult> jpsResult2 = JpsCmd.withVmArgs();
        //  获取本地虚拟机所有虚拟机进程id,同时获取主类参数
        List<JpsResult> jpsResult3 = JpsCmd.withMainClassArgs();
        //  获取本地虚拟机所有虚拟机进程id,同时获取jar或者主类全称
        List<JpsResult> jpsResult4 = JpsCmd.withFullName();

        //  自定义执行jps命令的参数,此处相当于在命令行执行jps -l
        List<JpsResult> jpsResult4 = JpsCmd.run(new String[]("-l"));
    }
}

交流

如果你在使用中发现了Bug,或者想对本作品提出意见或建议,请发送邮件到作者本人邮箱:beifengtz@163.com

关于作者

VmConsole详细介绍文档

目前为止,我已经封装了jps、jstat、jstack、jinfo、jcmd、jamp六个命令,使用者可以直接通过每个工具类的run方法直接执行相关命令(主需要传入参数,不需要传入jps、jstat等命令),命令格式和jdk提供的工具命令格式一模一样,也可以使用我已经封装好了的方法,不过为了方便以及可靠性保证,建议你使用已经封装好的方法。

  • JpsCmd:获取本地虚拟机实例的ID、主类信息、虚拟机参数等,封装于命令jps
  • JInfoCmd:获取和设置系统参数信息、虚拟机参数信息,封装于命令jinfo
  • JStatCmd:获取虚拟机内存状态信息,包括GC信息、编译类信息、元数据内存信息,封装于命令jstat
  • JStackCmd:获取虚拟机堆栈信息,包括线程堆栈、dump文件、c/c++方法堆栈等,封装于命令jstack
  • JMapCmd:获取虚拟机堆内存配置数据、Eden & Survivor & Old区内存使用量和比例、输出dump文件、获取class实例信息等,封装于jmap
  • JCmd:向某一个虚拟机示例执行命令,封装于jcmd

1.JPSCmd

JpsCmd类可以获取本地虚拟机实例的虚拟机唯一识别VMID、虚拟机参数、主类参数和jar全称等。对应原生jdk命令jps

1.1方法

名称 参数 返回值 含义
quit() List<JpsResult> 仅获取本地所有虚拟机实例的vmId
withMainClassArgs() List<JpsResult> 获取本地所有虚拟机实例的vmId和main函数的参数
withVmArgs() List<JpsResult> 获取本地所有虚拟机实例的vmId和虚拟机参数
withFullName() List<JpsResult> 获取本地所有虚拟机实例的vmId和主类或jar全名
run() String[] var0 (命令参数) List<JpsResult> 自定义参数执行jps命令,建议使用上面的方法

1.2结果对象

所有可能返回对象的继承关系结构

|—— beifengtz.vmconsole.entity.JvmResult
    |—— beifengtz.vmconsole.entity.jps.JpsResult

JvmResult的内容介绍请见开始使用。

1.2.1 JpsResult

属性 类型 含义
mianClass String 虚拟机主类信息
mainArgs String 虚拟机主类参数
vmArgs String 虚拟机参数
vmFlags String 虚拟机标志数据
errMessage String jps命令错误信息
strResult String 未经处理的 jps命令执行结果,不建议使用,后续版本将去掉

2.JInfo

获取以及设置系统参数、虚拟机参数等信息。封装自命令:jinfo

2.1 方法

名称 参数 返回值 含义
queryFlagsAndSysInfo() int vmId (虚拟机ID,JpsCmd可获取) JInfoResult 查询虚拟机flag信息和系统参数信息
queryFlags() int vmId(虚拟机ID,JpsCmd可获取) JInfoResult 查询虚拟机flag信息
querySysInfo() int vmId (虚拟机ID,JpsCmd可获取) JInfoResult 查询系统参数信息
queryFlag() 1. int vmId
2. String flagName(标志名称)
JInfoResult 查询某一个Flag的值
addFlag() 1. int vmId
2. String flagName(标志名称)
JInfoResult 新增一个Flag
removeFlag() 1. int vmId
2. String flagName(标志名称)
JInfoResult 移除一个Flag
setFlag() 1. int vmId
2. String flagName(标志名称)
3. String value(标志的值)
JInfoResult 为一个Flag设置值
run() String[] var0(命令参数) JInfoResult 自定义执行jinfo命令,不过建议你使用上面的方法

2.2 结果对象

所有可能返回对象的继承关系结构

|—— beifengtz.vmconsole.entity.JvmResult
    |—— beifengtz.vmconsole.entity.jinfo.JInfoResult

|—— beifengtz.vmconsole.entity.jinfo.JInfoNode
    |—— beifengtz.vmconsole.entity.jinfo.JInfoFlag

2.2.1 JInfoNode / JInfoFlag

属性 类型 含义
option String 选项/flag名
value String 选项/flag的值

2.2.2 JInfoResult

属性 类型 含义
infoList List<JInfoNode> 系统信息列表
flags List<JInfoFlag> 虚拟机标志信息列表
commandLine String 命令行
commandType String 命令类型
setSuccess boolean 用于判断写操作是否成功,仅当执行命令为操作该属性才有用

3.JStatCmd

获取虚拟机内存状态信息,包括GC信息、编译类信息、元数据内存信息,封装于命令jstat

3.1 方法

名称 参数 返回值 含义
list() JStatResult 获取虚拟机信息列表,仅包含名字
snap() int vmId(虚拟机ID,JpsCmd可获取) JStatResult 获取虚拟机信息及其值列表,包含名字和对应值
clazz() int vmId(虚拟机ID,JpsCmd可获取) JStatResultForClass 获取虚拟机加载的类信息
clazz() 1. int vmId(虚拟机ID,JpsCmd可获取)
2. long interval(命令执行时间)
3. int count(在该执行时间内获取的数量)
ArrayList<JStatResultForClass > 批量获取虚拟机加载的类信息,在interval时间内获取count个
gc() int vmId(虚拟机ID,JpsCmd可获取) JStatResultForGc 获取gc数据
gc() 1. int vmId(虚拟机ID,JpsCmd可获取)
2. long interval(命令执行时间)
3. int count(在该执行时间内获取的数量)
ArrayList<JStatResultForGc> 批量获取虚拟机gc数据,在interval时间内获取count个
compiler() int vmId(虚拟机ID,JpsCmd可获取) JStatResultForGcCapacity 获取虚拟机编译信息
compiler() 1. int vmId(虚拟机ID,JpsCmd可获取)
2. long interval(命令执行时间)
3. int count(在该执行时间内获取的数量)
ArrayList<JStatResultForGcCapacity> 批量获取虚拟机编译信息,在interval时间内获取count个
gcCapacity() int vmId(虚拟机ID,JpsCmd可获取) JStatResultForGcCapacity 获取虚拟机GC内存情况
gcCapacity() 1. int vmId(虚拟机ID,JpsCmd可获取)
2. long interval(命令执行时间)
3. int count(在该执行时间内获取的数量)
ArrayList<JStatResultForGcCapacity> 批量获取虚拟机GC内存情况,在interval时间内获取count个
gcNew() int vmId(虚拟机ID,JpsCmd可获取) JStatResultForGcNew 获取虚拟机新生代GC情况
gcNew() 1. int vmId(虚拟机ID,JpsCmd可获取)
2. long interval(命令执行时间)
3. int count(在该执行时间内获取的数量)
ArrayList<JStatResultForGcNew> 批量获取虚拟机新生代GC情况
gcNewCapacity() int vmId(虚拟机ID,JpsCmd可获取) JStatResultForGcNewCapacity 获取虚拟机新生代GC内存情况
gcNewCapacity() 1. int vmId(虚拟机ID,JpsCmd可获取)
2. long interval(命令执行时间)
3. int count(在该执行时间内获取的数量)
ArrayList<JStatResultForGcNewCapacity > 批量获取虚拟机新生代GC内存情况
gcOld() int vmId(虚拟机ID,JpsCmd可获取) JStatResultForGcOld 获取虚拟机老年代GC情况
gcOld() 1. int vmId(虚拟机ID,JpsCmd可获取)
2. long interval(命令执行时间)
3. int count(在该执行时间内获取的数量)
ArrayList<JStatResultForGcOld> 批量获取虚拟机老年代GC情况
gcOldCapacity() int vmId(虚拟机ID,JpsCmd可获取) JStatResultForGcOldCapacity 获取虚拟机老年代GC内存情况
gcOldCapacity() 1. int vmId(虚拟机ID,JpsCmd可获取)
2. long interval(命令执行时间)
3. int count(在该执行时间内获取的数量)
ArrayList<JStatResultForGcOldCapacity> 批量获取虚拟机老年代GC内存情况
gcMetaCapacity() int vmId(虚拟机ID,JpsCmd可获取) JStatResultForGcMetaCapacity 获取元数据空间内存情况
gcMetaCapacity() 1. int vmId(虚拟机ID,JpsCmd可获取)
2. long interval(命令执行时间)
3. int count(在该执行时间内获取的数量)
ArrayList<JStatResultForGcMetaCapacity > 批量获取元数据空间内存情况
gcUtil() int vmId(虚拟机ID,JpsCmd可获取) JStatResultForGcUtil 获取gc统计数据
gcUtil() 1. int vmId(虚拟机ID,JpsCmd可获取)
2. long interval(命令执行时间)
3. int count(在该执行时间内获取的数量)
ArrayList<JStatResultForGcUtil > 批量获取gc统计数据
printCompilation() int vmId(虚拟机ID,JpsCmd可获取) JStatResultForCompilation 获取已经被JIT编译的方法
printCompilation() 1. int vmId(虚拟机ID,JpsCmd可获取)
2. long interval(命令执行时间)
3. int count(在该执行时间内获取的数量)
ArrayList<JStatResultForCompilation> 批量获取已经被JIT编译的方法
run() String[] var0(命令参数) ArrayList<JStatResult> 自定义执行jstat命令

3.2 结果对象

所有可能返回对象的继承关系结构

|—— beifengtz.vmconsole.entity.JvmResult
    |—— beifengtz.vmconsole.entity.jstat.JStatResult
        |—— beifengtz.vmconsole.entity.jstat.JStatResultForClass
        |—— beifengtz.vmconsole.entity.jstat.JStatResultForCompilation
        |—— beifengtz.vmconsole.entity.jstat.JStatResultForCompiler
        |—— beifengtz.vmconsole.entity.jstat.JStatResultForGc
        |—— beifengtz.vmconsole.entity.jstat.JStatResultForGcCapacity
        |—— beifengtz.vmconsole.entity.jstat.JStatResultForGcMetaCapacity
        |—— beifengtz.vmconsole.entity.jstat.JStatResultForGcNew
        |—— beifengtz.vmconsole.entity.jstat.JStatResultForGcNewCapacity
        |—— beifengtz.vmconsole.entity.jstat.JStatResultForGcOld
        |—— beifengtz.vmconsole.entity.jstat.JStatResultForGcOldCapacity
        |—— beifengtz.vmconsole.entity.jstat.JStatResultForGcUtil

3.2.1 JStatResult

属性 类型 含义
names ArrayList<String> 虚拟机信息列表,仅包含名字
snapShot ArrayList<String> 虚拟机信息及其值列表,包含名字和对应值
strResult String 未经处理的 jstat命令执行结果,不建议使用,后续版本将去掉

3.2.2 JStatResult各子类属性含义

参数详细讲解看我的博客:JVM虚拟机性能监控与故障处理工具

S0C:s0(from)的大小
S1C:s1(from)的大小
S0U:s0(from)已使用的空间
S1U:s1(from)已经使用的空间
EC:eden区的大小
EU:eden区已经使用的空间
OC:老年代大小
OU:老年代已经使用的空间
MC:元空间的大小(Metaspace)
MU:元空间已使用大小
CCSC:压缩类空间大小(compressed class space)
CCSU:压缩类空间已使用大小
YGC:新生代gc次数
YGCT:新生代gc耗时
FGC:Full gc次数
FGCT:Full gc耗时
GCT:gc总耗时
e:Eden区使用比例
o:老年代使用比例
m:元数据区使用比例
css:压缩使用比例
Loaded:表示载入了类的数量
Bytes:所占用空间大小
Unloaded:表示卸载类的数量
UnBytes:卸载空间大小
Time:执行时间
Size:最近编译字节码的数量
Type:最近编译方法的编译类型
Method:方法名
Compiled:表示编译任务执行的次数
Failed:表示编译失败的次数
Invalid:不可用数量
FailedType:失败的类型
FailedMethod:失败的方法

4.JStackCmd

获取虚拟机堆栈信息,包括线程堆栈、dump文件、c/c++方法堆栈等,封装于命令jstack

4.1 方法

名称 参数 返回值 含义
threadStack() int vmId(虚拟机ID,JpsCmd可获取) JStackResult 除堆栈外,获取关于锁的附加信息
jniStack() int vmId(虚拟机ID,JpsCmd可获取) JStackResult 如果调用到本地方法的话,可以获取C/C++的堆栈
threadDump() int vmId(虚拟机ID,JpsCmd可获取) JStackResult 除堆栈外,获取关于锁、dump文件的附加信息
run() String[] var0(命令参数) JStackResult 自定义执行jstack命令

4.2 结果对象

所有可能返回对象的继承关系结构

|—— beifengtz.vmconsole.entity.JvmResult
    |—— beifengtz.vmconsole.entity.jstack.JStackResult
    |—— beifengtz.vmconsole.entity.jstack.ThreadStack

4.2.1 ThreadStack

属性 类型 含义
id String 线程id
state String 线程状态
stacks StringBuilder 线程堆栈信息
deadLocks String 线程死锁信息
currentJavaSP String 当前线程全限名地址
concurrentLocks String 并发锁信息

4.2.2 JStackResult

属性 类型 含义
deadLocks String 虚拟机死锁信息
concurrentLocks String 虚拟机并发锁信息
threadStacks List<ThreadStacks> 线程栈信息列表
jniStack ArrayList<StringBuilder> Java及C/C++方法的堆栈信息
threadDump String 锁、dump文件的附加信息

5.JMapCmd

获取虚拟机堆内存配置数据、Eden & Survivor & Old区内存使用量和比例、输出dump文件、获取class实例信息等,封装于jmap

5.1 方法

名称 参数 返回值 含义
dumpAll() 1. int vmId(虚拟机ID,JpsCmd可获取)
2.String filePath(保存的文件路径)
boolean 输出jvm的heap内容到文件,保存成功返回true,失败返回false
dumpLive() 1. int vmId(虚拟机ID,JpsCmd可获取)
2.String filePath(保存的文件路径)
boolean 输出jvm的heap内容到文件,但只输出还存活的对象,保存成功返回true,失败返回false
histoAll() int vmId(虚拟机ID,JpsCmd可获取) InputStream 获取每个class的实例信息
histoList() int vmId(虚拟机ID,JpsCmd可获取) InputStream 获取每个class的实例信息,但只输出还存活的对象
heapInfo() int vmId(虚拟机ID,JpsCmd可获取) JMapForHeapResult 获取堆内存信息,包括Eden、Survivor From、Survivor To、Old区等

5.2 结果对象

所有可能返回对象的继承关系结构

|—— beifengtz.vmconsole.entity.JvmResult
    |—— beifengtz.vmconsole.entity.jmap.JMapForHeapResult 

|—— beifengtz.vmconsole.entity.jmap.JMapForHeapUsage
|—— beifengtz.vmconsole.entity.jmap.HeapForSpace
|—— beifengtz.vmconsole.entity.jmap.HeapForG1
|—— beifengtz.vmconsole.entity.jmap.HeapForGen

5.2.1 HeapForSpace

属性 类型 含义
name String 堆区域名
regions String 使用G1垃圾收集器时,表示所在区域
capacity String 该区域总容量 ,单位byte
used String 已使用的大小 ,单位byte
free Sting 空闲的大小,单位byte
useRatio String 内存使用比例,百分数%

5.2.2 HeapForG1

属性 类型 含义
heap HeapSpace G1收集器的堆空间情况
eden HeapSpace G1收集器的Eden区空间情况
survivor HeapSpace G1收集器的Survivor区空间情况
old HeapSpace G1收集器的Old区空间情况

5.2.3 HeapForGen

属性 类型 含义
newGen HeapSpace 普通收集器的Eden 和 Survivor区空间情况
youngEden HeapSpace 普通收集器的Eden区空间情况
youngFrom HeapSpace 普通收集器的Survivor From区空间情况
youngTo HeapSpace 普通收集器的Survivor To区空间情况
oldGen HeapSpace 普通收集器的Old区空间情况

5.2.4 JMapForHeapUsage

属性 类型 含义
heapForGen HeapForGen 普通收集器的堆空间情况
heapForG1 HeapForG1 G1收集器的堆空间情况

5.2.5 JMapForHeapResult

属性 类型 含义
heapConf HashMap<String, Object> 堆空间配置信息
heapUsage JMapForHeapUsage 堆空间使用情况

6. JCmd

向某一个虚拟机示例执行命令,比如你当前是虚拟机A,需要向虚拟机B执行命令,则需要次类相关方法。封装于jcmd

6.1 方法

名称 参数 返回值 含义
listProcess() JCmdResult 列出虚拟机进程列表
listCommands() int vmId(虚拟机ID,JpsCmd可获取) JCmdResult 列出虚拟机支持的命令,后期将取消,由JCmdEnum对象代替
executeCommand() 1. int vmId(虚拟机ID,JpsCmd可获取)
2. JCmdEnum jCmdEnum(命令枚举类)
JCmdResult 向某一个虚拟机实例执行命令
executeCommand() 1. int vmId(虚拟机ID,JpsCmd可获取)
2. JCmdEnum... jCmdEnum(命令枚举类数组)
JCmdResult 向某一个虚拟机实例执行批量命令,后期将取消

6.2 结果对象

|—— beifengtz.vmconsole.entity.JvmResult
    |—— beifengtz.vmconsole.entity.jcmd.JCmdResult

|—— beifengtz.vmconsole.entity.jcmd.JCmdProcess
|—— beifengtz.vmconsole.entity.jcmd.JCmdEnum

6.2.1 JCmdEnum

JFR_STOP("JFR.stop"),
JFR_START("JFR.start"),
JFR_DUMP("JFR.dump"),
JFR_CHECK("JFR.check"),
VM_NATIVE_MEMORY("VM.native_memory"),
VM_CHECK_COMMERCIAL_FEATURES("VM.check_commercial_features"),
VM_UNLOCK_COMMERCIAL_FEATURES("VM.unlock_commercial_features"),
MANAGEMENTAGENT_STOP("ManagementAgent.stop"),
MANAGEMENTAGENT_START_LOCAL("ManagementAgent.start_local"),
MANAGEMENTAGENT_START("ManagementAgent.start"),
GC_ROTATE_LOG("GC.rotate_log"),
THREAD_PRINT("Thread.print"),
GC_CLASS_STATS("GC.class_stats"),
GC_CLASS_HISTOGRAM("GC.class_histogram"),
GC_HEAP_DUMP("GC.heap_dump"),
GC_RUN_FINALIZATION("GC.run_finalization"),
GC_RUN("GC.run"),
VM_UPTIME("VM.uptime"),
VM_FLAGS("VM.flags"),
VM_SYSTEM_PROPERTIES("VM.system_properties"),
VM_COMMAND_LINE("VM.command_line"),
VM_VERSION("VM.version");

6.2.2 JCmdProcess

属性 类型 含义
vmId int 虚拟ID
content String 虚拟机进程信息内容

6.2.3 JCmdResult

属性 类型 含义
processes List<JCmdProcess> 进程信息列表
result String 命令执行结果
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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.

简介

一个jvm虚拟机性能监控api,将oracle jdk提供的tools.jar包进行了功能拓展,对一些监控命令结果进行了封装,你可以方便地从对象中读取每一个参数和结果。该类库并不是简单地使用运行时exec()调用jps、jstat、jstack等命令,而是从底层深度拓展而来,所以你不需要配置java环境变量就可以通过Java代码对虚拟机进行监控。 展开 收起
Java
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/tzfun/VmConsole-Api.git
git@gitee.com:tzfun/VmConsole-Api.git
tzfun
VmConsole-Api
VmConsole-Api
master

搜索帮助