Triggering task through JMX

Hey guys,
I’m looking into Cassandra’s code and I’m wondering how mean services are checked ? For example, I’m running a cleanup through a JMX call, but that call is not blocking AFAIK. I get a status code though which should tell me if the task failed or succeeded, or if it was at least triggered. Reading Nodetool’s code, I can see that when we don’t provide a hostname it runs the code locally through a new JVM whereas when we do it remotely it uses JMX. I’m not sure, but it seems the command is blocking. Can someone elaborate on how it works ? And how we get the status of the remote command when they start a long process.
Thank you
—
Cyril Scetbon