GC listener

YU ZHANG yu.zhang at oracle.com
Fri Mar 21 15:25:37 UTC 2014


Milan,

You can use mbeans to to monitor gc activities:
http://docs.oracle.com/javase/7/docs/technotes/guides/management/mxbeans.html
Here is an example:
http://www.fasterj.com/articles/gcnotifs.shtml

It is hard to predict full gcs.  Maybe MemoryPoolMXBean for old gen can 
have some thing like mBean.setUsageThreshold(yourThreshold), then in the 
handleNotification method do what you need to do before full gc?

Thanks,
Jenny

On 3/21/2014 3:37 AM, Milan Mimica wrote:
> Hello
>
> Would it be possible for the application to register some kind of a 
> listener to track GC activity, and that way predict when Full GC is 
> going to happen?
> My application is a service behind a load balancer, and if it could 
> see Full GC which stops the world coming, given some time to react, it 
> could exclude itself from the balancer.
> //
>
> *Milan Mimica, *Software Engineer / Team Leader
>
> Visit Infobip website <http://www.infobip.com>
>
> Office: *Mletacka 12/III, 52100 Pula, Croatia*  |  Fax: 
> *+38552210979*  |  Mobile: *+385993061692*
>
> Email: *Milan.Mimica at infobip.com*  |  Skype: *mmimicaib*
>
> *www.infobip.com* <http://www.infobip.com>   / *GSMA Associate 
> Member*   / *Mobey Forum Member*
> This message is private and confidential. Any views or opinions 
> expressed are solely those of the author and do not necessarily 
> represent those of Infobip d.o.o. If you have received this message in 
> error, please notify us immediately via email to 
> customer.support at infobip.com <mailto:customer.support at infobip.com>or 
> telephone +442032864235.
>
>
>
>
> _______________________________________________
> hotspot-gc-use mailing list
> hotspot-gc-use at openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-gc-use/attachments/20140321/58ca21b9/attachment.html>


More information about the hotspot-gc-use mailing list