[root@test_back-1~]# jmap -help
Usage:
jmap [option]
(to connect to running process)
jmap [option]
(to connect to a core file)
jmap [option] [server_id@]
(to connect to remote debug server)
where
is one of:
to print same info as Solaris pmap
-heap to print java heap summary
-histo[:live] to print histogram of java object heap; if the "live"
suboption is specified, only count live objects
-clstats to print class loader statistics
-finalizerinfo to print information on objects awaiting finalization
-dump: to dump java heap in hprof binary format
dump-options:
live dump only live objects; if not specified,
all objects in the heap are dumped.
format=b binary format
file= dump heap to
Example: jmap -dump:live,format=b,file=heap.bin
-F force. Use with -dump: or -histo
to force a heap dump or histogram when does not
respond. The "live" suboption is not supported
in this mode.
-h | -help to print this help message
-J to pass directly to the runtime system
[root@test_back-1~]# jmap -heap 30109
Attaching to process ID 30109, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.74-b02
using parallel threads in the new generation.
using thread-local object allocation.
Concurrent Mark-Sweep GC
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 1073741824 (1024.0MB)
NewSize = 174456832 (166.375MB)
MaxNewSize = 174456832 (166.375MB)
OldSize = 899284992 (857.625MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 157024256 (149.75MB)
used = 46988880 (44.81208801269531MB)
free = 110035376 (104.93791198730469MB)
29.924599674587856% used
Eden Space:
capacity = 139591680 (133.125MB)
used = 46461032 (44.308692932128906MB)
free = 93130648 (88.8163070678711MB)
33.283525207232984% used
From Space:
capacity = 17432576 (16.625MB)
used = 527848 (0.5033950805664062MB)
free = 16904728 (16.121604919433594MB)
3.0279403342340228% used
To Space:
capacity = 17432576 (16.625MB)
used = 0 (0.0MB)
free = 17432576 (16.625MB)
0.0% used
concurrent mark-sweep generation:
capacity = 899284992 (857.625MB)
used = 49281872 (46.99885559082031MB)
free = 850003120 (810.6261444091797MB)
5.480117252974239% used
29566 interned Strings occupying 3583576 bytes.
4. jstack,查看java栈及本地方法栈信息
[root@test_back-1~]# jstack -help
Usage:
jstack [-l]
(to connect to running process)
jstack -F [-m] [-l]
(to connect to a hung process)
jstack [-m] [-l]
(to connect to a core file)
jstack [-m] [-l] [server_id@]
(to connect to a remote debug server)
Options:
-F to force a thread dump. Use when jstack does not respond (process is hung)
-m to print both java and native frames (mixed mode)
-l long listing. Prints additional information about locks
-h or -help to print this help message
[root@test_back-1~]# jstack -l 30109
"Reference Handler" #2 daemon prio=10 os_prio=0 tid=0x00007f1e80120000 nid=0x75a5 in Object.wait() [0x00007f1e84a61000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
- locked <0x00000000ca967f48> (a java.lang.ref.Reference$Lock)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
Locked ownable synchronizers:
- None
"main" #1 prio=5 os_prio=0 tid=0x00007f1e8000a000 nid=0x759f runnable [0x00007f1e87d70000]
java.lang.Thread.State: RUNNABLE
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
at java.net.ServerSocket.accept(ServerSocket.java:513)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:466)
at org.apache.catalina.startup.Catalina.await(Catalina.java:743)
at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)
Locked ownable synchronizers:
- None
"VM Thread" os_prio=0 tid=0x00007f1e80118800 nid=0x75a4 runnable
"Gang worker#0 (Parallel GC Threads)" os_prio=0 tid=0x00007f1e8001b000 nid=0x75a0 runnable
"Gang worker#1 (Parallel GC Threads)" os_prio=0 tid=0x00007f1e8001c800 nid=0x75a1 runnable
"Concurrent Mark-Sweep GC Thread" os_prio=0 tid=0x00007f1e8004a000 nid=0x75a2 runnable
"VM Periodic Task Thread" os_prio=0 tid=0x00007f1e80756000 nid=0x75b6 waiting on condition
JNI global references: 689
5. jinfo,查看jvm配置信息
[root@test_back-1~]# jinfo -help
Usage:
jinfo [option]
(to connect to running process)
jinfo [option]
(to connect to a core file)
jinfo [option] [server_id@]
(to connect to remote debug server)
where
is one of:
-flag to print the value of the named VM flag
-flag [+|-] to enable or disable the named VM flag
-flag = to set the named VM flag to the given value
-flags to print VM flags
-sysprops to print Java system properties
to print both of the above
-h | -help to print this help message
[root@test_back-1~]# jinfo 30109
Attaching to process ID 30109, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.74-b02
Java System Properties:
java.vendor = Oracle Corporation
rocketmq.client.logFileName = ons.log
sun.java.launcher = SUN_STANDARD
catalina.base = /wdzj/java/tomcat_8080
...
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
file.encoding = UTF-8
java.specification.version = 1.8
VM Flags:
Non-default VM flags: -XX:CICompilerCount=2 -XX:InitialHeapSize=1073741824 -XX:MaxHeapSize=1073741824 -XX:MaxNewSize=174456832 -XX:MaxTenuringThreshold=6 -XX:MinHeapDeltaBytes=196608 -XX:NewSize=174456832 -XX:OldPLABSize=16 -XX:OldSize=899284992 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -
示例:查看指定进程栈信息
[root@test_back-1 ~]# top -Hp 30109 #查看这个JVM进程里面的进程运行情况
top - 15:01:01 up 123 days, 8:43, 3 users, load average: 0.20, 0.13, 0.05
Tasks: 246 total, 0 running, 246 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.5%us, 0.7%sy, 0.0%ni, 97.0%id, 0.8%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 3924700k total, 3654884k used, 269816k free, 160024k buffers
Swap: 3989496k total, 120700k used, 3868796k free, 1181444k cached
Unknown command - try 'h' for help
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
30126 root 20 0 3980m 762m 15m S 0.7 19.9 0:59.70 java
...
[root@test_back-1 ~]# printf "%x \n" 30126 #转换进程id为16进制
75ae
[root@test_back-1 ~]# jstack 30109|grep 75ae --color -C 5 #查看进程里面的栈信息
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"DataCarrier.DEFAULT.Consumser.0.Thread" #10 daemon prio=5 os_prio=0 tid=0x00007f1e8070f000 nid=0x75ae sleeping[0x00007f1e84295000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at org.apache.skywalking.apm.commons.datacarrier.consumer.ConsumerThread.run(ConsumerThread.java:72)
"Thread-3" #9 daemon prio=5 os_prio=0 tid=0x00007f1e8026e000 nid=0x75aa waiting on condition [0x00007f1e84413000]
androi中提到了布尔数组;
布尔数组默认的是false, 并且只会打印false或者是true
布尔数组的例子; 根据字符数组创建布尔数组
char[] c = {'p','u','b','l','i','c'};
//根据字符数组的长度创建布尔数组的个数
boolean[] b = new bool
文章摘自:http://blog.csdn.net/yangwawa19870921/article/details/7553181
在编写HQL时,可能会出现这种代码:
select a.name,b.age from TableA a left join TableB b on a.id=b.id
如果这是HQL,那么这段代码就是错误的,因为HQL不支持
1. 简单的for循环
public static void main(String[] args) {
for (int i = 1, y = i + 10; i < 5 && y < 12; i++, y = i * 2) {
System.err.println("i=" + i + " y="
异常信息本地化
Spring Security支持将展现给终端用户看的异常信息本地化,这些信息包括认证失败、访问被拒绝等。而对于展现给开发者看的异常信息和日志信息(如配置错误)则是不能够进行本地化的,它们是以英文硬编码在Spring Security的代码中的。在Spring-Security-core-x
近来工作中遇到这样的两个需求
1. 给个Date对象,找出该时间所在月的第一天和最后一天
2. 给个Date对象,找出该时间所在周的第一天和最后一天
需求1中的找月第一天很简单,我记得api中有setDate方法可以使用
使用setDate方法前,先看看getDate
var date = new Date();
console.log(date);
// Sat J
MyBatis的update元素的用法与insert元素基本相同,因此本篇不打算重复了。本篇仅记录批量update操作的
sql语句,懂得SQL语句,那么MyBatis部分的操作就简单了。 注意:下列批量更新语句都是作为一个事务整体执行,要不全部成功,要不全部回滚。
MSSQL的SQL语句
WITH R AS(
SELECT 'John' as name, 18 as