Re: [Simpleweb-Support] Simpleweb-Support Digest, Vol 7, Issue 3
Brought to you by:
niallg
From: R P. <pat...@gm...> - 2007-03-29 07:05:33
|
Hi Stephan, Something that works perfectly for me: public class MyServer implements Runnable { public void run() { System.err.println("Server is shutting down..."); // Close all (simple's connection, others)... ........ // This finalize all simpleweb's threads Runtime.getRuntime().runFinalization(); } public final static void shutdown() { // Shutdown your Simple server and exit! Runtime.getRuntime().exit(0); } protected MyServer() { Thread shutdownHook = new Thread(this, "shutdown-hook"); Runtime.getRuntime().addShutdownHook(shutdownHook); } } 2007/3/28, sim...@li... < sim...@li...>: > > Send Simpleweb-Support mailing list submissions to > sim...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > or, via email, send a message with subject or body 'help' to > sim...@li... > > You can reach the person managing the list at > sim...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Simpleweb-Support digest..." > > > Today's Topics: > > 1. DomainHandler with HTTP 1.0 (Jeff Nichols) > 2. Re: DomainHandler with HTTP 1.0 (Jeff Nichols) > 3. How to shutdown? ( Stefan H?bner ) > 4. Re: How to shutdown? (Oscar Perez) > 5. Re: How to shutdown? ( Stefan H?bner ) > 6. Re: How to shutdown? (Niall Gallagher) > 7. Re: How to shutdown? ( Stefan H?bner ) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 16 Mar 2007 13:17:13 +0100 > From: Jeff Nichols <je...@ne...> > Subject: [Simpleweb-Support] DomainHandler with HTTP 1.0 > To: Simple support and user issues > <sim...@li...> > Message-ID: <5C0...@ne...> > Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed > > Hello Niall (and all), > > After a tedious 2 day debugging session, I finally figured out why > PayPal's IPN (Instant Payment Notification) system was not working > with my server. > > I'm using the virtual hosting facilities of Simple (through the > DomainHandler) and PayPal is (for whatever reason) sending their > notifications with HTTP/1.0. This creates a problem, as the > DomainHandler only works with HTTP/1.1 requests (which should include > a 'Host' header). > > Is there any way around this? I thought of writing a specialized > DomainHandler that would fall back to parsing its own 'Host' if none > was available, but I cannot find anywhere in the Request where the > entire URL is available. > > Any help is greatly appreciated. > > Jeff > > > > ------------------------------ > > Message: 2 > Date: Fri, 16 Mar 2007 14:11:26 +0100 > From: Jeff Nichols <je...@ne...> > Subject: Re: [Simpleweb-Support] DomainHandler with HTTP 1.0 > To: Simple support and user issues > <sim...@li...> > Message-ID: <C2F...@ne...> > Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed > > An update: > > In the Simple API docs for DomainHandler.handle(Request,Response) it > states: > > "For compatibility with HTTP/1.0 clients that do not support the Host > header this delegates the processing of requests without the Host > header to a default ProtocolHandler." > > Depending on how this statement is interpreted, it is not entirely > correct, as this method does not look for a 'Host' header unless HTTP/ > 1.1 is being used. > > Well low and behold, the PayPal HTTP/1.0 request seems to include a > 'Host' header. So a workaround (for me) seems possible by > subclassing DomainHandler and overriding 'handle'. > > Jeff > > > > On Mar 16, 2007, at 1:17 PM, Jeff Nichols wrote: > > > Hello Niall (and all), > > > > After a tedious 2 day debugging session, I finally figured out why > > PayPal's IPN (Instant Payment Notification) system was not working > > with my server. > > > > I'm using the virtual hosting facilities of Simple (through the > > DomainHandler) and PayPal is (for whatever reason) sending their > > notifications with HTTP/1.0. This creates a problem, as the > > DomainHandler only works with HTTP/1.1 requests (which should include > > a 'Host' header). > > > > Is there any way around this? I thought of writing a specialized > > DomainHandler that would fall back to parsing its own 'Host' if none > > was available, but I cannot find anywhere in the Request where the > > entire URL is available. > > > > Any help is greatly appreciated. > > > > Jeff > > > > ---------------------------------------------------------------------- > > --- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to > > share your > > opinions on IT & business topics through brief surveys-and earn cash > > http://www.techsay.com/default.php? > > page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Simpleweb-Support mailing list > > Sim...@li... > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > > > > ------------------------------ > > Message: 3 > Date: Wed, 21 Mar 2007 18:26:11 +0100 > From: " Stefan H?bner " <sth...@go...> > Subject: [Simpleweb-Support] How to shutdown? > To: sim...@li... > Message-ID: > <a36...@ma...> > Content-Type: text/plain; charset=UTF-8; format=flowed > > Hi, > > Excuse me, if this has been asked before, but how do I shutdown a > LoaderEngine? Is there a way to do so? > > Cheers, > Stefan > > > > ------------------------------ > > Message: 4 > Date: Wed, 21 Mar 2007 18:31:42 +0100 > From: Oscar Perez <os...@te...> > Subject: Re: [Simpleweb-Support] How to shutdown? > To: Simple support and user issues > <sim...@li...> > Message-ID: <460...@te...> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Hi, > I don't have an answer to you, but I faced the same problem just a week > ago and what I did was to track all the started threads to kill them at > shutdown time. I'll not post my code here now, but I'll advise you to > not do as me, as I lost a lot of hours tracking threads and debugging... > I guess LoaderEngine was not designed to have a clean shutdown? > > > En/na Stefan H?bner ha escrit: > > Hi, > > > > Excuse me, if this has been asked before, but how do I shutdown a > > LoaderEngine? Is there a way to do so? > > > > Cheers, > > Stefan > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > opinions on IT & business topics through brief surveys-and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Simpleweb-Support mailing list > > Sim...@li... > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > > > > > > > > ------------------------------ > > Message: 5 > Date: Wed, 21 Mar 2007 20:54:23 +0100 > From: " Stefan H?bner " <sth...@go...> > Subject: Re: [Simpleweb-Support] How to shutdown? > To: "Simple support and user issues" > <sim...@li...> > Message-ID: > <a36...@ma...> > Content-Type: text/plain; charset=UTF-8; format=flowed > > Hi Oscar, > > 2007/3/21, Oscar Perez <os...@te...>: > > Hi, > > I don't have an answer to you, but I faced the same problem just a week > > ago and what I did was to track all the started threads to kill them at > > shutdown time. I'll not post my code here now, but I'll advise you to > > not do as me, as I lost a lot of hours tracking threads and debugging... > > Thank you for that :-) > > > I guess LoaderEngine was not designed to have a clean shutdown? > > > What I figured out, when I had a second look into Simple's code, is > that there is at least the opportunity to close() the ServerSocket the > connection is connect()ed with. After close() Simple won't serve any > request sent to the port the socket was serving. > > But getting rid of all those threads seems like a mission impossible, > given how much Simple relies on Singletons. One hardly gets the chance > to get hold of all those hidden instances, I guess. > > Cheers, > Stefan > > > > En/na Stefan H?bner ha escrit: > > > Hi, > > > > > > Excuse me, if this has been asked before, but how do I shutdown a > > > LoaderEngine? Is there a way to do so? > > > > > > Cheers, > > > Stefan > > > > > > > ------------------------------------------------------------------------- > > > Take Surveys. Earn Cash. Influence the Future of IT > > > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > > > opinions on IT & business topics through brief surveys-and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > _______________________________________________ > > > Simpleweb-Support mailing list > > > Sim...@li... > > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > opinions on IT & business topics through brief surveys-and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Simpleweb-Support mailing list > > Sim...@li... > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > ------------------------------ > > Message: 6 > Date: Thu, 22 Mar 2007 02:42:52 -0700 (PDT) > From: Niall Gallagher <gal...@ya...> > Subject: Re: [Simpleweb-Support] How to shutdown? > To: Simple support and user issues > <sim...@li...> > Message-ID: <695...@we...> > Content-Type: text/plain; charset=iso-8859-1 > > Hi, > > I have written a signalling framework which will be used in Simple so send > signals to all threads and processes within the server when something > happens. For instance a shutdown signal will be distributed to all threads > to allow them to shutdown cleanly. When I get the time to finally release > the next version this will be included it is located at: > > > https://svn.sourceforge.net/svnroot/simpleweb/branches/3.2/src/simple/signal/ > > Niall Gallagher > > ----- Original Message ---- > From: Stefan H?bner <sth...@go...> > To: Simple support and user issues < > sim...@li...> > Sent: Wednesday, March 21, 2007 7:54:23 PM > Subject: Re: [Simpleweb-Support] How to shutdown? > > Hi Oscar, > > 2007/3/21, Oscar Perez <os...@te...>: > > Hi, > > I don't have an answer to you, but I faced the same problem just a week > > ago and what I did was to track all the started threads to kill them at > > shutdown time. I'll not post my code here now, but I'll advise you to > > not do as me, as I lost a lot of hours tracking threads and debugging... > > Thank you for that :-) > > > I guess LoaderEngine was not designed to have a clean shutdown? > > > What I figured out, when I had a second look into Simple's code, is > that there is at least the opportunity to close() the ServerSocket the > connection is connect()ed with. After close() Simple won't serve any > request sent to the port the socket was serving. > > But getting rid of all those threads seems like a mission impossible, > given how much Simple relies on Singletons. One hardly gets the chance > to get hold of all those hidden instances, I guess. > > Cheers, > Stefan > > > > En/na Stefan H?bner ha escrit: > > > Hi, > > > > > > Excuse me, if this has been asked before, but how do I shutdown a > > > LoaderEngine? Is there a way to do so? > > > > > > Cheers, > > > Stefan > > > > > > > ------------------------------------------------------------------------- > > > Take Surveys. Earn Cash. Influence the Future of IT > > > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > > > opinions on IT & business topics through brief surveys-and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > _______________________________________________ > > > Simpleweb-Support mailing list > > > Sim...@li... > > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > opinions on IT & business topics through brief surveys-and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Simpleweb-Support mailing list > > Sim...@li... > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > > > > > ____________________________________________________________________________________ > We won't tell. Get more on shows you hate to love > (and love to hate): Yahoo! TV's Guilty Pleasures list. > http://tv.yahoo.com/collections/265 > > > > ------------------------------ > > Message: 7 > Date: Wed, 28 Mar 2007 16:43:59 +0200 > From: " Stefan H?bner " <sth...@go...> > Subject: Re: [Simpleweb-Support] How to shutdown? > To: "Simple support and user issues" > <sim...@li...> > Message-ID: > <a36...@ma...> > Content-Type: text/plain; charset=UTF-8; format=flowed > > Ah, sorry for the delay. Thanks Niall, I'll have a look in the next days! > > Cheers, > Stefan > > 2007/3/22, Niall Gallagher <gal...@ya...>: > > Hi, > > > > I have written a signalling framework which will be used in Simple so > send signals to all threads and processes within the server when something > happens. For instance a shutdown signal will be distributed to all threads > to allow them to shutdown cleanly. When I get the time to finally release > the next version this will be included it is located at: > > > > > https://svn.sourceforge.net/svnroot/simpleweb/branches/3.2/src/simple/signal/ > > > > Niall Gallagher > > > > ----- Original Message ---- > > From: Stefan H?bner <sth...@go...> > > To: Simple support and user issues < > sim...@li...> > > Sent: Wednesday, March 21, 2007 7:54:23 PM > > Subject: Re: [Simpleweb-Support] How to shutdown? > > > > Hi Oscar, > > > > 2007/3/21, Oscar Perez <os...@te...>: > > > Hi, > > > I don't have an answer to you, but I faced the same problem just a > week > > > ago and what I did was to track all the started threads to kill them > at > > > shutdown time. I'll not post my code here now, but I'll advise you to > > > not do as me, as I lost a lot of hours tracking threads and > debugging... > > > > Thank you for that :-) > > > > > I guess LoaderEngine was not designed to have a clean shutdown? > > > > > What I figured out, when I had a second look into Simple's code, is > > that there is at least the opportunity to close() the ServerSocket the > > connection is connect()ed with. After close() Simple won't serve any > > request sent to the port the socket was serving. > > > > But getting rid of all those threads seems like a mission impossible, > > given how much Simple relies on Singletons. One hardly gets the chance > > to get hold of all those hidden instances, I guess. > > > > Cheers, > > Stefan > > > > > > En/na Stefan H?bner ha escrit: > > > > Hi, > > > > > > > > Excuse me, if this has been asked before, but how do I shutdown a > > > > LoaderEngine? Is there a way to do so? > > > > > > > > Cheers, > > > > Stefan > > > > > > > > > ------------------------------------------------------------------------- > > > > Take Surveys. Earn Cash. Influence the Future of IT > > > > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > > > > opinions on IT & business topics through brief surveys-and earn cash > > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > > _______________________________________________ > > > > Simpleweb-Support mailing list > > > > Sim...@li... > > > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > Take Surveys. Earn Cash. Influence the Future of IT > > > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > > > opinions on IT & business topics through brief surveys-and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > _______________________________________________ > > > Simpleweb-Support mailing list > > > Sim...@li... > > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > opinions on IT & business topics through brief surveys-and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Simpleweb-Support mailing list > > Sim...@li... > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > > > > > > > > > > > > ____________________________________________________________________________________ > > We won't tell. Get more on shows you hate to love > > (and love to hate): Yahoo! TV's Guilty Pleasures list. > > http://tv.yahoo.com/collections/265 > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > opinions on IT & business topics through brief surveys-and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Simpleweb-Support mailing list > > Sim...@li... > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > ------------------------------ > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > ------------------------------ > > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > End of Simpleweb-Support Digest, Vol 7, Issue 3 > *********************************************** > |