Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8641123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:26:46+00:00 2026-06-12T11:26:46+00:00

I have a simple Tomcat 7 Server where I want to implement a Java

  • 0

I have a simple Tomcat 7 Server where I want to implement a Java Web Service which offers some data I can get via my mobile phone.
The point is I want the data on the server being updated every once in a while. So I need a “background process” which updates the data.

I first tried to start a new thread in the constructor of my binding implementation class (which implements only my own Service – not a HttpServlet or so) like

public NewBindingImpl(){   
  Thread informationFetcher = new InformationFetcher();   
  informationFetcher.start(); 
}

But I didn’t think about the fact that this class gets created every time someone is using the service. Further more this would update the data only the moment I ask for them. But how could I update them lets say every two hours or so?

Hopefully someone here has an idea. Is that even possible for a “simple” web service?

Thank you very much,

Tobias

EDIT: —-

Maybe it helps to know that I tried this very basic tutorial here:

http://www.elearning.witnut.com/230/java-web-service-creation-using-top-development-approach/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:26:47+00:00Added an answer on June 12, 2026 at 11:26 am

    Why not initialise the thread when the servlet’s init() method is called ? You can shut it down when the corresponding destroy() method is called. The thread will be bound to the lifecycle of the servlet and since init() is only called once, you won’t have to worry about multiple instances.

    Here’s a brief tutorial on the init() method usage.

    Since you want something running every two hours, check out the Timer class. For more complex scenarios Quartz is a serious contender.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a simple web Application which is running(on Tomcat Server) fine on
I have developed a simple Apache-Axis java web service using Eclipse IDE and now
I have an extremely simple web application running in Tomcat using Spring 3.0.2, Hibernate
We have a Java web application and we'd like to set up some basic
I have a Tomcat v7.0 server setup in my eclipse (helios) environment which I
If I have a web service / application in Tomcat, do I have to
I have a standalone simple java web application with servlets and jsp, say the
Suppose we want to design a Java EE web application system which is expected
I'm in charge of maintaining a web application (Lives on a Tomcat server) which
I have built a streaming relay server using Tomcat. Simple idea is: one client

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.