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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:26:57+00:00 2026-05-22T16:26:57+00:00

Greetings, I am curious if there is someway to check if ArrayBlockingQuery query is

  • 0

Greetings, I am curious if there is someway to check if ArrayBlockingQuery query is currently locked ?
The reason for this : I have a server which is listens to a socket, receives parameters, process them and then returns some result to client. That server(let say it is server A) while processing parameters open session with other server( server B) and then send info to B. Only one session can be created when connecting to B, but A can accept several client connection. Because of that ArrayBlockingQueue is used to stored that parameters and some other thread run through the queue and send them one by one to B.

I need to do that functionality – when ArrayBlockingQueue is empty and nothing is processed in current moment and client data send to A then process immediately – send data to B server, process response from B and then A return response to client if ArrayBlockingQuery is not empty and something is processed then just add parameters to queue and send other response from A to client. Thats why i need to know if there is a way to check if ArrayBlockingQueue is locked or queue element currently processed by thread.

Thank you!

  • 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-22T16:26:58+00:00Added an answer on May 22, 2026 at 4:26 pm

    Is there any reason you don’t just use a Lock as this is designed for protecting resources which can only be used in one thread at a time.

    // in a client connection thread
    lock.lock();
    try {
        // use connection to server B
    } finally {
        lock.unlock();
    }
    

    This ensures server B will only be use in one thread at a time and you don’t need to add anything to a queue.


    Not sure what a ArrayBlockingQuery is, nor does google. Do you mean ArrayBlockingQueue?

    An ArrayBlockingQueue is not locked for very long, so this information isn’t very useful. However you could obtain the lock via reflection.

    You appear to be over thinking your solution.

    You want to ensure that server B only get a connection one at a time, and you are using a queue to do this, however you want to way to by-pass this, but this means discarding your one at a time principle.

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

Sidebar

Related Questions

Greetings, I have a particular object which can be constructed from a file, as
Greetings, I am curious if there is any good plugin or project that allows
Greetings. I have an 2-D array of size [N][N] which will represent a rectangular
Greetings I have an ajax call which: Gets an xml file of posts Populates
Greetings and salutations, I have two Android apps: one is the server and one
Greetings! I am trying to check directory write-permissions from within a Windows MFC/ATL program
Greetings, currently I am refactoring one of my programs, and I found an interesting
Greetings, I have an asp.net mvc application. I have some links that corresponds to
Greetings, in my asp.net mvc application I have a listbox rendered as follows: <%=
Greetings Everyone. I'm currently writing a multi-language programe in C, C++ and fortran on

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.