The best way to restart a mooring instance

I use start.jar and stop.jar to stop and start a mooring instance. I restart by calling stop.jar, then start.jar. The problem is that if I haven’t slept long enough between stop.jar and start.jar, I start getting these random ClassNotFoundExceptions, and the application does not work correctly.

Sleeping for a longer period of time between stopping and starting is my current option.

I also heard from someone that I must have something that controls my threads so that I finish them before the pier. It's right? The question that I have about this is that stop.jar returns immediately, so it doesn’t help me if there isn’t something that I don’t see. Another option is to poll the log file, but it's pretty ugly.

What is the best way to restart the pier?

Gilbert: The Ant task is certainly not a bad way to accomplish it. However, he sleeps for a certain amount of time, which I am trying to avoid.

+3
source share
3 answers

Can you write a shell script that does something like this after a shutdown call and before running?

LISTEN_PORT = `netstat -vatn | grep LISTEN | grep 8080 | wc -l `
while [$ LISTEN_PORT -ne 0]; do
    sleep 1
    LISTEN_PORT = `netstat -vatn | grep LISTEN | grep 8080 | wc -l `
done
+1
source

This thread looks old, but published anyway, may help someone. Cross-platform approach:

http://ptrthomas.wordpress.com/2009/01/24/how-to-start-and-stop-jetty-revisited/

+1
source

JFGI? Ant , ?

This blog post details how to set up goals that can start and stop the jetty for you. You can easily bend another target, called “restart the pier,” which depends on the “haven,” and then calls the “pier.”

http://ptrthomas.wordpress.com/2006/10/10/how-to-start-and-stop-jetty-from-ant/

0
source

Source: https://habr.com/ru/post/1697220/


All Articles