RE: Bootstrap stop()

2007-02-28 Thread Fran Varin

Chuck, 
Thank you for your reply. What has lead me down this path is that I am
trying to use Bootstrap.start() and .stop() to manage a Tomcat instance
within a main that I have written. The behavior that I'm seeing is that it
seems that .stop() does not actually cause the server to come all the way
down and the second message to .start() does not seem to bring it back up. 

So, while in a debug session I noticed one thread still hanging around after
messaging .stop(). It seems to me that I should be able to manage the
instance using .start() and .stop() assuming my understanding is correct.
Given that, the behavior looks like one of two things to me, either some
kind of bug, or more likely my lack of understanding of Tomcat internals
being sufficient to manage the instance properly. 

I did see the Runnable being passed and made the assumption that it was
being used to supply the run method. My probing through that source was to
gain an understanding of the mechanism used to terminate the threads. I
stopped there because I felt I was way in the weeds of Tomcat, beyond what
should be necessary to accomplish my task. 

Fran




-- 
View this message in context: 
http://www.nabble.com/Bootstrap-stop%28%29-tf3296281.html#a9207055
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] Bootstrap stop()

2007-02-27 Thread Fran Varin


I took a look at the source for Tomcat 6 and the // FIXME remains in the
destroy method within Bootstrap as well. 

The lack of documentation around this part of Tomcat's API is not helping
much here either. So, it begs the question is what I've coded sufficient to
start and stop Tomcat from a Java class sufficient or am I missing
something?

Any help would be greatly appreciated. 

Fran 
-- 
View this message in context: 
http://www.nabble.com/Bootstrap-stop%28%29-tf3296281.html#a9183310
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] Bootstrap stop()

2007-02-27 Thread Fran Varin

OK, after spending a considerable amount of time crawling through Tomcat's
Bootstrap and Catalina classes. I have narrowed the problem down I believe.
It seems that the Bootstrap.stop() method is capable of stopping all of the
threads except for one named http-8080 When the Bootstrap.start() is
subsequently invoked an exception is throw when the start() method attempts
to load the class loaders again. The only remnant of Tomcat left at that
point is the lone thread I mentioned above. In looking at the class for the
thread org.apache.tomcat.util.threads.ThreadWithAttributes there does not
appear to be a way to bring the thread down gracefully. In tracking down the
actual source, it extends Thread which usually means there is a concrete
run() method...not in this case. So, tomcat must be using a technique I'm
not familiar with to satisfy the run() requirement. 

It seems from looking at the code that tomcat attempts to allow a restart of
sorts but, to my un-enlightened eye it looks like the implementation is not
quite there to fully support that notion. So, it looks like once you start a
tomcat instance within a JVM you are for the most part stuck with it unless
you want to terminate the entire JVM and restart the application. I'm not
sure that is a good long term solution but, it is the best I can do I think
at this point. 

If anyone has any insights please don't hesitate to share. 

Fran 




Fran Varin wrote:
 
 
 I took a look at the source for Tomcat 6 and the // FIXME remains in the
 destroy method within Bootstrap as well. 
 
 The lack of documentation around this part of Tomcat's API is not helping
 much here either. So, it begs the question is what I've coded sufficient
 to start and stop Tomcat from a Java class sufficient or am I missing
 something?
 
 Any help would be greatly appreciated. 
 
 Fran 
 

-- 
View this message in context: 
http://www.nabble.com/Bootstrap-stop%28%29-tf3296281.html#a9198023
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [OT] Bootstrap stop()

2007-02-27 Thread Caldarale, Charles R
 From: Fran Varin [mailto:[EMAIL PROTECTED] 
 Subject: Re: [OT] Bootstrap stop()
 
 In looking at the class for the thread 
 org.apache.tomcat.util.threads.ThreadWithAttributes 
 there does not appear to be a way to bring the thread
 down gracefully. In tracking down the actual source,
 it extends Thread which usually means there is a
 concrete run() method...not in this case. So, tomcat
 must be using a technique I'm not familiar with to
 satisfy the run() requirement. 

Note the Runnable object used in the ThreadWithAttributes constructor;
that provides the necessary run() method, not the subclass of Thread.
Look at the API doc for java.lang.Thread for more information.  The two
Tomcat classes that utilize ThreadWithAttributes are:
  org.apache.tomcat.util.net.MasterSlaveWorkerThread
  org.apache.tomcat.util.threads.ThreadPool

You'll find the real methods in there (including ones to stop the
threads).

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Bootstrap stop()

2007-02-26 Thread Fran Varin

I've been working on a class that will start and stop Tomcat from via a JMenu
item. It seems I have tomcat starting correctly with the following code: 

class StartListener implements ActionListener {
public void actionPerformed(ActionEvent event) {
try {

bootStrap.setCatalinaHome(C:\\Varin\\Java_Dev\\Servers\\Tomcat\\apache-tomcat-5.5.20);
bootStrap.start();
} catch (Throwable e ) {
System.out.println(Unable to start Tomcat);
e.printStackTrace();
return;
}
System.out.println(Tomcat Started...);
}
} //End Class SaveAsListener




...and I'm using the following to stop the Tomcat instance: 

class StopListener implements ActionListener {
public void actionPerformed(ActionEvent event) {
try {
bootStrap.stop();
bootStrap.destroy();
} catch (Throwable e ) {
System.out.println(Unable to stop Tomcat);
e.printStackTrace();
return;
}
System.out.println(Tomcat stopped...);
}
} //End Class SaveAsListener




The issue that I am having is that when I select the start a second time
Tomcat does not seem to start. Also, when I select stop and then hit the
Tomcat server I receive a 503 message as opposed to a server not found.
So, this leads me to believe that the server is in fact not actually
stopping. 


The documentation is really spartan in this area so, I took a look at the
source for Bootstrap...there is a destroy method that according to the
javadoc is supposed to end the daemon but, it has a single comment in it
with no body that just says fix me. So, I'm thinking maybe there really is
no way to bring the daemon down so that it can be recycled. 

Any help would be appreciated. 

Fran

-- 
View this message in context: 
http://www.nabble.com/Bootstrap-stop%28%29-tf3296281.html#a9169712
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]