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(“Invalid username or password”);
        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

Reply via email to