Wicket: how to cope with long-term tasks

I installed the Wicket + Hibernate + Spring web application, which includes collecting some data (with some files generated and returned), storing this in a database, creating some images and displaying all of this on a web page.

All this works great for short runs, but sometimes data collection (which is associated with some removal of headliners) takes too much time (20+ minutes) and waiting time. I tried to resolve this using two approaches, but both of them show some problems.

The first approach was to use AjaxLazyLoadPanel and just did everything in getLazyLoadComponent. This worked fine for short runs, but for the 20 minute launches the LazyLoadComponents did not load (a good oxymoron there) due to timeouts.

The second approach involved creating an intermediate fragment with added AjaxSelfUpdatingTimerBehavior with a duration of 10 seconds, which was polled for files that are created when the number is crunched. It seems that tasks are running in the background without problems, but fail when the returned data needs to be stored in the database. I am using the Open Session in View template, but maybe this fails when I try to save the data after 20 minutes? (The solution may be to resolve this issue.).

Due to the above issues, I am currently reading alternative approaches for handling these lengthy tasks and have come across them:

Now I'm wondering if any of them can be better suited to solve the timeout problems that I have when starting tasks and storing data in a database, or if someone has other solutions that can help in this situation.

I would really like to know if the new approach is effective before I spend another day trying to prevent something from working.

Yours faithfully,
Tim

+6
java hibernate timeout wicket
source share
1 answer

I know that we have successfully used the panel with the attached AjaxSelfUpdatingTimerBehavior. The task and part of the results are separated from the presentation logic, but become available for presentation through the created service. The implementation of the service we used is then responsible for running TheadPool or ExectutorService to run individual tasks. A service can provide a way to track the progress / status of a specific task / challenge that is taking place. Once it is completed, it must also make the data available for presentation. Injecting a SessionFactory into the service implementation (or introduced by the DAO) should be sufficient to create a HibernateSession outside of the WebSession.

+3
source share

All Articles