• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Stop Servlet

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hallo all,
I have 3 different servlet running on tomcat 7.0.5, in one container (Record, Replay and Stop). Record give me the possibility to save information from web on my local disk. I can call different instance of Record, each return me data from different social network.
is it possible to mark every instance of Record servlet with a unique ID and stop a specific instance of that servlet (knowed by an ID passed by the URL) through the other servlet called Stop? If it is possible how i can take control of servlet using an ID through another servlet?
Thank you in advance, regards
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you should back off a bit and create a different architecture. Recall that servlets are intended to service multiple requests "at the same time".

Bill
 
m baldo
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you bill, but do you think that i have to create 3 different web application running on tomcat and try to stop that using tomcat manager??
Can you give me a suggestion??
Thanks again
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are you talking about a servlet at all?

I can call different instance of Record, each return me data from different social network.



Sounds like you want to create a HTTP connection to a site like a browser does, not create a site that gets requests.

People frequently use something like the HttpClient toolkit to create connections emulating a browser.

Bill
 
m baldo
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need a servlet because i use the data returned by the program to create a stream of RDF quadruple instead of a snapshot of data, i extract useful information using sparql query on stream.
Because of this i need to start and stop servlet from remote, but i can't figure out how to stop a specific instance of servlet...
Thanks in advance for every help.
 
Ranch Hand
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

m baldo wrote:use the data returned by the program to create a stream of RDF quadruple instead of a snapshot of data, i extract useful information using sparql query on stream.



Sorry if I'm asking an odd question, but can't you do the above in a normal java program ?
Maybe if you elaborate the above i'll be able to suggest a solution.
 
m baldo
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The connection to the social network and the manipulation of the data is done by a java program, but my goal is to make this program controllable via http, because of this i'm using servlet, the java program launched by the servlet in the future will be improved: more social network, more platform where to save data and more option about query engine. My problem is not the java program, it works very well, i need some help only with the servlet.
I can start the servlet using user parameter to do what he wants, but i don't know how to identify and stop a specific servlet instance.
Thanks
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Controlling another program from a servlet is certainly possible, but why are you fixated on stopping and restarting the servlet?

A little thought on the architecture should get you a much more flexible and scalable design.


Bill
 
m baldo
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can i use ServletContext to save e pair: <id thread , something to identify and control thread>?
Does someone have suggestion on what is something to identify and control thread?
Thanks in advance, regards
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should probably stop trying to use Servlet in this fashion and shift to moving whatever logic is in the Servlet classes to simple POJO business objects. You could still use a servlet to get to this logic, but will avoid the need to have to control specific instances of a particular servlet and introduce undesirable code.


A little thought on the architecture should get you a much more flexible and scalable design

 
Aniruddh Joshi
Ranch Hand
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what's the exact usecase when you want to stop the servlet ?
 
m baldo
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my servlet thread i call a java programs that return me useful data.
I can stop the right servlet thread using the servletcontext to save the right information, but how can i stop all the thread of the java program that i have created into the servlet main thread (these are not a cild thread of the main one)?
Thanks in advance, regards
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Exactly what Thread do you think needs to be stopped?

A "running" servlet container has a Thread that gets a port connection attempt and turns it into a HTTP request from a client then hands off the request processing to a Thread that is dedicated to creating a response to that request. Using a request Thread for extended processing is a really bad idea.

When multiple experienced servlet programmers tell you that you are on the wrong track, don't you think it might be a good idea to listen to them?

Bill
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

William Brogden wrote:When multiple experienced servlet programmers tell you that you are on the wrong track, don't you think it might be a good idea to listen to them?



Just in case one more voice will help: m baldo, you're on the wrong track!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic