This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to know whether server instance is running or not?  RSS feed

 
prem nath
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
how do i know from the normal java class whether server instance in cluster(say weblogic cluster) is running if the server name and port are given?i can able to do that by using the URL to a resource but it is taking time.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Setting up a HttpURLConnection and trying to retrieve a page is about the only thing I have done. I wonder why that's taking too much time for you. If the server is up it should respond pretty quickly, and if it's down you should get the error even more quickly.

I have done this on web services and found a system where the HTTP server was up so I got no HTTP error, but the business service was "stopped" somehow. By some quirk in their code it just never returned anything.

You might find some administrative interface to query. In Java 5 and later, see how JConsole connects to a JVM and queries it. Can't imagine the connect would be much faster than an HttpURLConnection.
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i can able to do that by using the URL to a resource but it is taking time.
You should expect it to take some time. I assume you aren't only interested in whether it is running, you are really interested in whether it is capable of responding to requests? Then the time to find that out would be comparable to the time to send a request and receive the response.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!