-1

We have a specific part in our project which sometimes can take a really long time to complete its database operations. This can be worse if we use the database which can be only accessed using a VPN.

I know that you can increase the overall session time with this:

<context-param>
        <description>Tempo limite em minutos da sessão do usuário</description>
        <param-name>timeout_sessao_web</param-name>
        <param-value>20</param-value>

</context-param>

We have this parameter in our web.xml file for a 20 minutes session. I could easly change this value, but i've been told not to.

And i know that there is this:

@Synchronized(timeout = 300000)

That is in every bean. I have some questions:

  1. Increasing this value, will increase the session time for a specific page, or the value in my web.xml will prevail?
  2. Is there another way to handle specific session timeouts for some pages, or it's something that affects the whole project?
Tiny
  • 27,221
  • 105
  • 339
  • 599
Joao Victor
  • 1,111
  • 4
  • 19
  • 39
  • You're barking up the wrong tree here. The session timeout is for session inactivity, not for requests. A session operation that takes 20 minutes won't cause a session timeout of any kind. I suggest you look at why it takes so long, and fix it, rather than applying a pointless bandaid. What will happen is not a session timeout, but that the users will walk away. – user207421 Sep 02 '15 at 12:34
  • Whatever that annotation is from (project Lombok?), it has absolutely nothing to do with the web session timeout. Are you perhaps asking about how to implement a session keep alive strategy for a page (as in: the session won't expire as long as that page is open) ? – Gimby Sep 02 '15 at 12:42

2 Answers2

0

the web.xml for the session timeout is the right place for all of the web sessions. When there exists the case that a database operation for a web session request takes about 20 minutes, I suggest you heavily rethink your implementation of the process. Further you could try to increase the timeout value for the specific HttpSession with "setMaxInactiveInterval()..." in a SessionScoped Bean. At least you should decouple this process from any web session when it takes that long.

BuckRogers
  • 13
  • 5
0
  1. The value in web.xml will prevail.
  2. AFAIK, there is no way to affect the session timeout of specific pages.

A better solution in my humble opinion (that does not involve extending the session) is to use asynchronous programming. Take a look at this thread:

Asynchronous Servlets vs. synchronous Servlets

Community
  • 1
  • 1
chrisl08
  • 1,658
  • 1
  • 15
  • 24