我們正在運行的Java版本低於卸載類的消息在標準輸出日誌中沒有-XX:+ CMSClassUnloadingEnabled
$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
當堆開始變得完全顯示在JBoss-EAP-6.0.1的應用程序,我開始看到大量的「卸載類...」消息,如下面的stdout日誌中的消息。我們沒有-XX:+ CMSClassUnloadingEnabled標誌,根據我發現的,我們不應該卸載類。我確實在Atlassian的站點(https://confluence.atlassian.com/display/JIRAKB/%5BUnloading+class+sun.reflect.GeneratedMethodAccessor%5D+found+in+Tomcat+logs)上發現了一條帖子,指出如果JVM發現它實際上沒有分配給它的資源,JVM將卸載沒有設置-XX:+ CMSClassUnloadingEnabled標誌的類(通常由於虛擬機膨脹或資源竊取)「。我還沒有看到其他地方的討論,想要了解JVM是否有可能嘗試收集類作爲獲得內存的最後努力,或者可能有其他解釋,例如我們的命令行中指定的選項隱式設置-XX:+ CMSClassUnloadingEnabled標誌。任何見解都值得讚賞。
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor897]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor709]
[Unloading class sun.reflect.GeneratedConstructorAccessor570]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor996]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor816]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor362]
[Unloading class sun.reflect.GeneratedMethodAccessor257]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor46]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor775]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor210]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor332]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor168]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor149]
的命令行選項是
java
-D[Standalone]
-server
-XX:+UseCompressedOops
-XX:+DisableExplicitGC
-Dsun.rmi.dgc.client.gcInterval=36000000
-Dsun.rmi.dgc.server.gcInterval=36000000
-Djs.license.directory=/opt/app/AgentDesktop/resources/jasper
-Djava.io.tmpdir=/opt/tmp
-Xloggc:/opt/app/logs/PRD00_C_gc.log
-XX:+PrintGCTimeStamps
-XX:+PrintGCDetails
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/opt/app/logs/heapDump/PRD00_C
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
-Dorg.apache.commons.logging.simplelog.log.org.apache.commons.httpclient.wire=ERROR
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-Xmx2560m
-Xms2560m
-XX:NewSize=512M
-XX:MaxPermSize=512m
-XX:PermSize=256M
-XX:+UseCompressedOops
-XX:AutoBoxCacheMax=2048
-Dorg.jboss.boot.log.file=/opt/app/logs/jboss/PRD00_C/boot.log
-Dlogging.configuration=file:/opt/app/jboss-eap-6.0.1/server/PRD00_C/configuration/logging.properties
-jar
/opt/app/jboss/jboss-modules.jar
-mp
/opt/app/jboss/modules
-jaxpmodule
javax.xml.jaxp-provider
org.jboss.as.standalone
-Djboss.home.dir=/opt/app/jboss
-Djboss.server.base.dir=/opt/app/jboss-eap-6.0.1/server/PRD00_C
--server-config=standalone-full-PRD.xml
--properties=file:/opt/app/AgentDesktop/work/jboss/combined.101932939.properties
-Djboss.socket.binding.port-offset=300
-Djboss.server.base.dir=/opt/app/jboss/server/PRD00_C
-Djboss.server.log.dir=/opt/app/logs/jboss/PRD00_C
-Dcom.kana.properties.url=file:/opt/app/AgentDesktop/work/jboss/combined.101932939.properties
-Dcom.gtnet.systemProperties.override.url=file:/opt/app/AgentDesktop/config/PRD//override.properties
-Dcore.home=/opt/app/AgentDesktop
-Denvironment.dir=/opt/app/AgentDesktop/config/PRD
-Denvironment.url=file:/opt/app/AgentDesktop/config/PRD/
-Drelease.id=1
-Dorg.apache.tomcat.util.http.Parameters.MAX_COUNT=1000
-Dorg.jboss.as.logging.per-deployment=false
-b
0.0.0.0
可能重複[JVM標誌CMSClassUnloadingEnabled實際上做了什麼?](http://stackoverflow.com/questions/3334911/what-does-jvm-flag-cmsclassunloadingenabled-actually-do) – Peeyush
您是否使用Jersey/JAXB ? –