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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:13:45+00:00 2026-06-02T04:13:45+00:00

Question, more than one thread of a process program could read sequentially from one

  • 0

Question, more than one thread of a process program could read sequentially from one static java.util.arrayqueue? If three threads of a process program are running and three data object arrive into the arrayqueue, each thread will process one data object or just one thread will process all three data object

  • 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-02T04:13:47+00:00Added an answer on June 2, 2026 at 4:13 am

    You’re describing the producer-consumer pattern.

    A few points

    • If you spawn three threads and they each loop, reading off the same queue then they will all try to consume the items on the queue. There’s no guarantees on how many items each thread will consume. This depends entirely on the scheduler of the threads in the JVM (or at the OS level). Generally speaking though if a large number of similar items are added to the queue each thread will consume roughly the same amount of items.

    • ArrayQueue is not a good choice for this use-case as it is not threadsafe. A better choice would be ConcurrentLinkedQueue or ConcurrentBlockingQueue

    To answer your question directly, yes you can have multiple threads reading from the same queue, but please consider the above.

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

Sidebar

Related Questions

There may be more than one way to ask this question, so here's a
This question is more a re-insurance than one directly about how to code. As
This is kinda....a two part question. The first one is much more important than
This is related to my previous question More than 1 Left joins in MSAccess
I suppose this question is more general than working with COM components. I have
This is primarily a question of possibilities more than instructions. I'm a programming consultant
This question is more about guidance than actually solving my problem: I need to
More than about LINQ to [insert your favorite provider here], this question is about
Alright I know this is more than likely a amateur question but I have
My question is to retrieve a shop who sell each item at more than

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.