Question: I have a use case, where I need to stop requests being sent to a java restful service, if the JVM of the service is currently doing a GC. How/which API can hep me to find this ?

Answer: 
There are different ways to monitor GC, but the only difference is how the GC operation information is shown. GC is done by JVM, and since the GC monitoring tools disclose the GC information provided by JVM, you will get the same results no matter how you monitor GC.

The GC monitoring methods can be separated into **CUI** and **GUI** depending on the access interface. The typical CUI GC monitoring method involves using a separate CUI application called "jstat", or selecting a JVM option called "verbosegc" when running JVM.

**jstat** is a monitoring tool in HotSpot JVM. Other monitoring tools for HotSpot JVM are jps and jstatd. Sometimes, you need all three tools to monitor a Java application.

-**verbosegc** is one of the JVM options specified when running a Java application. While jstat can monitor any JVM application that has not specified any options, -verbosegc needs to be specified in the beginning, so it could be seen as an unnecessary option (since jstat can be used instead).
You can probably do this by using visualVM and it's API. The visual vm is the visualization of the GC process. But it has it's own API as well.
[Visual VM](https://docs.oracle.com/javase/7/docs/technotes/guides/visualvm/index.html)