I discovered that deeper in my code there was a synchonization problem where both the large process and the main process were fighting over the same resource. This is why the two processes seemed to be splitting time. Removing the synchronization problem allowed both processes to run in parallel and the main process to finish on time. I am still curious if there is a way to allow the request cycle to finish before starting the large process. I messed around with thread priorities, but is didn’t seem to matter.
On 2016-05-27 16:39, Jered Myers <j...@maplewoodsoftware.com> wrote: > More details:> > When I run my large process in a thread, the thread that is rendering the > next page, and the large process, are getting generally equal slices of > processing time and end at about the same time. The page I am navigating too > also has heavy work to do in order to spin up data I need.> > > On 2016-05-27 12:51, Jered Myers <j....@maplewoodsoftware.com> wrote: > > > I have a large background process that I need to execute when a user > > submits a form. The background process can run while the user continues to > > use the application. I am having trouble allowing the user to continue > > working. How do I run this background process and allow the form submit to > > finish and let the user move on. I have tried using Threads and Futures. > > Here is example of a login page type of submit:> > > > > > > protected void onSubmit() > > > > {> > > > if (!authenticateUser(user)) > > > > {> > > > error(%u201CInvalid username or password%u201D);> > > > return;> > > > }> > > > > > > > if (user.requiresLargeProcess()) > > > > {> > > > Thread largeProcess = new Thread(new LargeProcessRunnable());> > > > largeProcess.start();> > > > }> > > > > > > continueToOriginalDestination();> > > > setResponsePage(Application.get().getHomePage());> > > > }> > > > > > > This example is simplified for clarity. In reality, the process is in a > > class that does not have access to Wicket code. This means I cannot do > > tricks like use an AbstractDefaultAjaxBehavior to make the call later. Can > > somebody please point me in the right direction? I think I am needing to > > spawn a thread that runs outside of the Wicket RequestCycle, but I am not > > sure that is the correct terminology.> > > > > > > Thanks for any help,> > > > Jered> > > > > > ---------------------------------------------------------------------> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org> > For additional commands, e-mail: users-h...@wicket.apache.org> > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org