Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Running a job through a Servlet

Reply
Thread Tools

Running a job through a Servlet

 
 
Kevin
Guest
Posts: n/a
 
      09-21-2007
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

 
Reply With Quote
 
 
 
 
Filip Larsen
Guest
Posts: n/a
 
      09-21-2007
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,
--
Filip Larsen
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      09-27-2007
>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?
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening new child window - Running servlet (JSP and Servlet) agapitolw@yahoo.es Java 4 08-27-2007 12:57 PM
Running C and Java programs through Servlet abdel.olakara@gmail.com Java 2 07-31-2006 09:15 PM
Servlet question(Tomcat, web.xml, servlet-class, servlet-name) circuit_breaker Java 2 04-04-2004 03:26 AM
Tomcat: POST from one servlet or internal class to another servlet Sean Clarke Java 1 01-07-2004 02:22 PM
how to get my servlet configuration before the servlet is initialised Andy Fish Java 4 12-17-2003 09:47 PM



Advertisments