Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2007

Tip: Looking for answers? Try searching our database.

Running a job through a Servlet

Thread view: 
Kevin - 21 Sep 2007 03:16 GMT
Hi all,

I would like to kick of a very long running process.  All classes used
by this job are instatiated through a spring context.  Our entire
application framework (on my development teams side) is a set of
webservices accessed by a client developed by another team.  Therefore
basically everything we do is a session.  There is a very long process
we have that we run locally that brings data in from one database,
manipulates that data, and then places the data into a different
database.  This entire process is slow since we are in Chicago and
both databases are in New York.  What I would like to do is deploy a
solution in our application server in New York that can run this job
on demand.  Beyond the data we take from the database we also supply
this job with a couple simple arguments (basically two strings).  I
have been tinkering around with JMX, however this just doesn't seem to
be panning the way I'd like.  What I would like to do is create a
simple servlet that we can feed our input of a couple string and have
it run the job.   I am in no way an expert with servelts and just have
a couple questions before I invest time going this route (if it is
indeed a viable route).  My concern is how can I kick a task off from
a servlet and let it continue to run when I end a browser session.  As
I said I am certainly no expert in when it comes to servlets so I am
just curious if I could say spawn a thread to run said task and have
this task continue to run outside of the servlets session (or context
even).  This could be a very simple thing, but just wanted to see if
there was a good way of doing this.  If there is anything you would
like me to clear up or if I am way of base with this path please let
me know.  I appreciate any suggestions and criticism.

Thank You,
Kevin
Filip Larsen - 21 Sep 2007 07:13 GMT
Kevin skrev:

> My concern is how can I kick a task off from
> a servlet and let it continue to run when I end a browser session.

One way could be to let the servlet spawn a new thread to do the work
in. Depending on how neat you want it, the servlet should probably keep
a reference to the working thread in a suitable (global) context so you
later can get status, result, terminate the job prematurely, and what
else you may find need for.

Regards,
Signature

Filip Larsen

Roedy Green - 27 Sep 2007 04:16 GMT
>One way could be to let the servlet spawn a new thread to do the work
>in. Depending on how neat you want it, the servlet should probably keep
>a reference to the working thread in a suitable (global) context so you
>later can get status, result, terminate the job prematurely, and what
>else you may find need for.
You might be better off just to create a standalone utility. Then it
would not be affected by the Servlet going up or down.
The womb is not doing much for you is it?
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.