• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to run a program in the background?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,
Here is my code after I click place order.

//step 1, pre-process an order
order.PreProcess();//this step takes 1 second.
//step 2, send order to ERP;
order.SendToErp;//this step takes 15 seconds.
//step 3, display JSP
CallJsp();//this step takes 2 seconds.
As you can see, after I click the submit button, it will take me around 20 seconds to display the next page.
My question is: how to move step 2 into the background, so, step 3 don't need to wait the return of step 2.
thanks,
Michael
[ November 20, 2002: Message edited by: Michael Deng ]
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do it in a separate Thread.
 
Michael Deng
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to do it in a separate Thread?
Thanks!
Michael
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michael,
Multi-threading is far too complicated to be explained in a discussion group post. You should find a good article or book that introduces threading and read that. Basically, you create a subclass of Thread (or a class that implements Runnable, which you pass into a Thread's constructor), and then call start(). Java Threads by Scott Oaks and Henry Wong (O'Reilly) is pretty good.
 
reply
    Bookmark Topic Watch Topic
  • New Topic