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

  • Home
  • SEARCH
  • 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 220089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:54:21+00:00 2026-05-11T18:54:21+00:00

I am writing a multi-threaded solution in Java to connect two systems, A &

  • 0

I am writing a multi-threaded solution in Java to connect two systems, A & B. System A is completly serial, not threaded, and will supply data to send to system B. System B accepts data from multiple sources asynchronously all at the same time.

I am using ThreadPoolExecutor to manage the threads. I am using a static singleton instance of a class, TP, that wraps around ThreadPoolExecutor (which is also static) because system A cannot create new objects but it can make calls to static objects.

Here is where I am stuck. I am doing some very basic testing of the setup before I go all out. I created two classes for testing, T1 & T2. Each of these classes imports the class TP (where the static singleton is created). T1 adds some objects to the TP queue and then T2 adds some more.

Even though the TP object is declared as static, it looks like there are two versions running in parallell. The objects submitted to the queue by T2 are being executed before the object submitted by T1 have all been executed. Also, since neither T1 or T2 calls shutdown() on the ThreadPoolExector, they both hang and never terminate.

How can I create a daemon static instance of a tread that basically wakes up whenever I send something to be processed, even from different Java executables?

  • 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-05-11T18:54:21+00:00Added an answer on May 11, 2026 at 6:54 pm

    If you’re running two separate processes, then you’ve got two separate types and two separate instances, regardless of whether it’s a singleton.

    If you want two different processes to talk to each other, you’ll need to address that issue entirely separately. There are plenty of different IPC mechanisms available – networking, named pipes (tricky from Java IIRC), memory mapped files, a simple shared directory where one process places tasks for the other to process etc.

    It’s also not clear exactly what’s hanging, or how your thread-pool is configured. If the problem really is the threading side (rather than the IPC side) then please post a short but complete program which demonstrates the problem.

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

Sidebar

Ask A Question

Stats

  • Questions 117k
  • Answers 117k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer That's not an easy question to answer. Computer architecture is… May 11, 2026 at 10:46 pm
  • Editorial Team
    Editorial Team added an answer static int GetFourDigitYear(int year, int maxYear) { System.Globalization.GregorianCalendar cal =… May 11, 2026 at 10:46 pm
  • Editorial Team
    Editorial Team added an answer Yes and no. No, the help browser that comes with… May 11, 2026 at 10:46 pm

Related Questions

Here's the scenario: I have a multi threaded java web application which is running
I am writing a multi-threaded Windows application in Microsoft Visual C# 2008 Express Edition.
I'm new to C++ and am writing a multi-threaded app whereby different writers will
I am looking at improving a package that I believe not to be threadsafe

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.