This week's book giveaway is in the Java in General forum. We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line! See this thread for details.
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.
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.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
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.