I am doing the same sort of thing with Tomcat. To start Tomcat I first check if Tomcat is running by trying to open a socket to it this throws an UnknownHostException if Tomcat is not running. If Tomcat is running, I stop it, then I start Tomcat and wait till it is running before returning. It takes a few seconds for Tomcat to start running and I don't want the rest of my application to interact with Tomcat until its really running. To stop Tomcat I call the shutdown.bat then wait till there is no Tomcat running before returning. What does restart mean to you? That you shutdown then start again?
I am not sure how similar JBoss is, does it have a shutdown.bat too? I am pretty sure the socket thing would be the same (or what ever address you configured JBoss too).
subject: To run and restart the jboss server through java