Thursday, July 30, 2015

Control ADF application Passivation Mode

In your ADF application you can set the session timeout of the application according to customer requirement.
If one of the customer want the application to be active for 3 hours what you will do?
The first thing you will think about is the session parameter (and you are right), you will open web.xml and set session timeout to 180


After setting the session timeout parameter you will deploy the application and the customer will test the application. Customer will login and will leave the application idle for 2 hours and will return back to the application he will find the session still active and it is ok. After the user try to use the application he will find the application will be in unexpected behavior and he will get some errors and he will find a lot of issues in the application.. why this issues happened?
because the application entered to the passivation mode.
Now you will ask me some questions like:
1- What is the passivation mode?
2- When the application will entered in the passivation mode?
3- What I have to do when the application become in passivation mode?
4- How can I test my application in passivation mode to test the application behavior in that mode?
5- How can I control the time that make the application to be in the passivation mode?
6- How can I configure my application to avoid the passivation mode?

I will answer all these questions:

1- What is the passivation mode?
In short description passivation mode will manage system resources. If you leave the application idle for along time the resources (database pool - memories - .. ) may gone to another active application and in this case your application will be in the passivation mode.
You can check this for more information about passivation

2- When the application will entered in the passivation mode?
By default after you leave the application 1 hour the application will enter to passivation mode.

3- What I have to do when the application become in passivation mode?
logout from the application and login again.

4- How can I test my application in passivation mode to test the application behavior in that mode?
Open AppModule and uncheck "Enable Application Module Pooling" for both local and shares then run the application.



5- How can I control the time that make the application to be in the passivation mode?
In the AppModule there is 2 parameters you have to set
jbo.ampool.maxinactiveage and jbo.ampool.timetolive

e.g:
jbo.ampool.maxinactiveage=18000000
jbo.ampool.timetolive=-1

time in maxinactiveage will be in ms so 18000000 is 5 hours.
These previous configurations means the application will enter the passivation mode after 5 hours.



6- How can I configure my application to avoid the passivation mode?
To avoid passivation mode you have to set the session timeout with value less than the passivation value.
e.g 

If the customer want the application to be active for 3 hours you can set session timeout to 180 (3 hours) and set passivation parameters to be 4 hours

jbo.ampool.maxinactiveage=14400000
jbo.ampool.timetolive=-1