Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2007

Tip: Looking for answers? Try searching our database.

why Tomcat is strange ? :)

Thread view: 
devphylosoff - 08 Sep 2007 22:51 GMT
hi all

i have script to restart Tomcat (stop, wait 3sec, run)
and sometime I receive two different process of server. and log that
"Socket bind failed: [98] Address already in use"

but also in a few cases all is good.
of course - both script startup.sh and shutdown.sh are in the same
directory and I have only one Tomcat on board.

any idea why it do that ?
Mike Schilling - 09 Sep 2007 02:57 GMT
> hi all
>
[quoted text clipped - 7 lines]
>
> any idea why it do that ?

Because sometimes Tomcat is taking more than three seconds to shut down.  It
tries to shutdown all of the applications it's running cleanly, and that can
take an indeterminate amount of time (well, there is an upper bound before
it just kills them outright, but it's large.)

One more reliable way to do this would be to write a Java program that tries
to bind to Tomcat's socket in a loop (not a tight loop; put a sleep in)  and
doesn't return until it can (or until it gives up after some timeout) and
have your script:

stop Tomcat
run bind-to-socket program
wait N seconds to be sure it's down
start
devphylosoff - 09 Sep 2007 20:16 GMT
> stop Tomcat
> run bind-to-socket program
> wait N seconds to be sure it's down
> start

I have script in perl which do that, but it is not enough.
You should sleep all time beetwen "socket is down" and "all of tomcat
is down".

Because after close socket, Tomcat do more closing tasks.
and if in that time I run startup.sh I receive 2 processes and no
response for www-requests.
Mike Schilling - 09 Sep 2007 21:53 GMT
>> stop Tomcat
>> run bind-to-socket program
[quoted text clipped - 4 lines]
> You should sleep all time beetwen "socket is down" and "all of tomcat
> is down".

Yes, that's the "wait N seconds to be sure it's down" step.
devphylosoff - 10 Sep 2007 00:04 GMT
that's crazy
I have 2x CoreDuo with 4GB ram
and I have to wait above 1 minute to full restart.

Some changes in code and restart Tomcat (coffee), changes and coffee,
all day.
Tomcat make me addicted to coffee.

is any way to speed up it?
Arne Vajhøj - 10 Sep 2007 01:39 GMT
> that's crazy
> I have 2x CoreDuo with 4GB ram
[quoted text clipped - 5 lines]
>
> is any way to speed up it?

Why not just restart/reload the app ?

Arne
Gordon Beaton - 10 Sep 2007 07:08 GMT
> Some changes in code and restart Tomcat (coffee), changes and
> coffee, all day. Tomcat make me addicted to coffee.
>
> is any way to speed up it?

Espresso.

/gordon

--
derek - 14 Sep 2007 14:57 GMT
look at your application, maybe it is the cause of it taking so long. i know when i shut down tomcat, its only a few seconds.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.