Shutdown time

The forum to discuss the Headless version of Servoy. Web, Java and Servlet development questions can all be posted here.

Shutdown time

Postby Thomas Parry » Thu Apr 30, 2009 1:18 pm

How long does it take an application running as a headless client to shutdown after it executes the
Code: Select all
application.exit()

method?

In my case it never seems to do so.

IS there some setting that can be adjusted to shorten the shutdown time if there is such as setting?

Tom
Servoy 3.5.9
Tom Parry
Prospect IT
Java/C++/Servoy/Jasper Reports/Simulation/Service Applications
http://www.prospect-saas.biz
Thomas Parry
 
Posts: 498
Joined: Thu Jan 10, 2008 8:48 pm
Location: Ottawa, Canada

Re: Shutdown time

Postby ptalbot » Thu Apr 30, 2009 3:04 pm

Headless client is basically JSP using "servoy aware" beans, so I guess that the timeout for a client session is the default used by Tomcat, which is 30 minutes.

You could lower that timeout by altering your web.xml file located in /Servoy/application_server/server/webapps/ROOT/WEB-INF/
with something like (unit is minutes):
Code: Select all
<session-config>
   <session-timeout>10</session-timeout>
</session-config>

before the ending </web-app> tag.

So in the example above, I have shortened the session to 10 minutes.

Be aware though, that by doing so you are shortening the life span of a session, meaning that if a user leave its browser open and go grab a coffee and start chatting with a colleague... if there is no browser activity for +10 minutes, his session will be lost (meaning that he will probably need to authenticate again, and if he was on a form and had began some editing, all his changes will be lost).

There are workaround for this, like using Ajax to periodically "ping" the server if the browser is still open, or having an invisible frame with a meta-refresh or a javascript which updates the page every 9,5 minutes.

I do it like that on all my web developments and I have people connected for hours on my system from the early morning to the evening with an hour lunch inactivity, if they leave their browser open, they keep their session open, if they don't then the session is closed after only 10 minutes (which is quite low in web standards).

Hope this helps,
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1654
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Shutdown time

Postby Thomas Parry » Thu Apr 30, 2009 7:50 pm

Thanks Patrick for an explanation :cry:
I am not skilled in JSP but knowing this little makes me wish for more fundamental methods available in the Servoy baseline as opposed to having to go get third party plugins or worse to make one's own!

My objective is to be able to shutdown a headless client once I have it finish its job. I thought that application.exit() would do that immediately rather than have a dependence on some other exotic factor.

I cannot of course have the session cut short like in your example.

My headless client only takes a few seconds at most to do its job, so I want it to cease to exist at that point.

I shall look at other ways to achieve my goal perhaps without having to use a headless client at all if I cannot find a way to kill the headless client or have it shut down by itself (quickly).
Tom Parry
Prospect IT
Java/C++/Servoy/Jasper Reports/Simulation/Service Applications
http://www.prospect-saas.biz
Thomas Parry
 
Posts: 498
Joined: Thu Jan 10, 2008 8:48 pm
Location: Ottawa, Canada

Re: Shutdown time

Postby ptalbot » Thu Apr 30, 2009 10:49 pm

If you trigger yourself the disconnection, in the headless JSP, you could try "session.invalidate()" to close the session.

Believe me, it's not that exotic ;-)
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1654
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Shutdown time

Postby Foobrother » Mon May 04, 2009 4:43 pm

Personnaly I use the following code when I want to stop my headless client
Code: Select all
session.setAttribute("servoy",null);


I don't know if it really kills the headless client or simply re-initiate it to null (and then kills it after the timeout) but it works fine for me. The headless client disappear straight from the connected clients list
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: Shutdown time

Postby ptalbot » Tue May 05, 2009 3:14 am

Sure, it should work equally fine. I just prefer session.invalidate() because it not only releases the Servoy session but also the Tomcat session as well...

Be nice to your server it will be nice to you in return ;-)
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1654
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC


Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 7 guests