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 7910909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:03:14+00:00 2026-06-03T13:03:14+00:00

I am developing a system where the server needs to send (every second) values

  • 0

I am developing a system where the server needs to send (every second) values to multiple clients. My idea was to implement a single Thread for each client to do this. I implemented the Threads in the following Fashion:

Runnable tu = new TimeUpdater(market_id);
Thread thread = ThreadManager.createBackgroundThread(tu);
thread.start(); 

and

public class TimeUpdater implements Runnable{
boolean close = false;
..
   public void run() {
      while(!close){

      try {
        //do something    
        Thread.sleep(1000);
      }catch (InterruptedException e) {
       }

      }
   }
}

To pause the Threads i just use:

thread.interrupt();
thread = null;

But i just can’t make the pause / resume of the threads work.
Does anyone have a better idea to use multithreading with GWT on the server?

Edited original post by mistake. – Martin

  • 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-03T13:03:15+00:00Added an answer on June 3, 2026 at 1:03 pm

    First, your background threads require these processes to be running on the backend. In order to do this, you must send a task to the backend, where you will already be in a running task, so adding threads is just more latency to your app. You do not actually need threads to dispatch messages; backend requests last for 10 minutes. Also, your threads will be running in their own request; you may be able to store a list of threads in static ram to be able to access them, but a better solution is distribute messages as they come in, rather than keep instances online and sleeping. If your clients send messages to the server every second, that rpc can just key-query which other users need to be notified, and send the messages immediately. If you use asynchronous datastore processes, it will be very fast. Also, if you want to cut request times, you can have the rpc start the message sends, then have the servlet return response, and then finalize the asynchronous requests after the reply is already going down the wire.

    I do post-processing like this using a ThreadLocal map and a cleanup filter. Servlets post jobs to a list of runnables, and the cleanup filter runs the jobs. So long as you start your async requests immediately, they are often done by the time the cleanup filter gets to them.

    https://developers.google.com/appengine/docs/java/datastore/async

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

Sidebar

Related Questions

I'm developing an email marketing system which allows users to send emails to multiple
I am developing a system which include a server app & a client app,
I'm currently developing a system to transmit data between client and server, and was
I'm developing a system which needs to store videos in the form: /path/to/video/<md5 of
I will be developing a system that will involve a data acquisition server where
I'm developing a product that needs to act as a server over a local
I am developing a client-server application for a cross-database system. I am using Eclipse
We are developing a vehicle tracking system. Like every VTS, we have GPS devices
We're developing a server system in Scala + Akka for a game that will
The system I am developing potentially has a very large number of clients (lets

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.