Running a job through a Servlet

K

Kevin

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
 
F

Filip Larsen

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,
 
R

Roedy Green

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top