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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:09:36+00:00 2026-05-17T21:09:36+00:00

I have a stand-alone JMS app that subscribes to several different JMS topics. Each

  • 0

I have a stand-alone JMS app that subscribes to several different JMS topics. Each topic has its own session and onMessage() listener. Each onMessage() method updates a common current value table – all the onMessage() methods update the same current value table.

I’ve read that the onMessage method is actually called on the JMS provider’s thread. So, my question is: if all these onMessage() methods are called on a separate thread than my app, doesn’t this present a concurrency problem since all these threads update a common CVT? Seems like I need to synchronize access to the CVT somehow?

  • 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-17T21:09:36+00:00Added an answer on May 17, 2026 at 9:09 pm

    Short answer to your question: YES, you need to take care of concurrency concerns when your JMS code is updating some common in-memory object.

    However, I’m not sure what you mean by “common current value table”? If this is some database table, then database should take care of concurrency issues for you.

    EDIT: it turned out that “common current value table” is a common in-memory object. As I mentioned earlier, in this case you need to handle the concurrency concerns yourself (Java concurrency tutorial).

    There are mainly two approaches to this problem:

    • synchronization – suitable if you have low-contention or you are stuck with some non-threadsafe object, then your best choice is synchronization.
    • high-level concurrency objects that come with the JDK – best fit if you have high-contention and you are using some class from regular collections; just swap in an instance of concurrent collections.

    In any case, it is highly recommended to do your own testing to choose the best approach for you.

    If you would be dealing with expensive to create non-threadsafe stateless procedural code (no storage of data involved) then you could also use object pooling (e.g. Commons Pool), but this is not relevant in your current issue.

    JMS onMessage() method is always called by the JMS provider’s thread (also known as asynchronous calling).

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

Sidebar

Related Questions

I have a stand-alone, Swing application that uses Hibernate for its persistence layer. I
I have a problem that I feel is best implimented in a stand alone
I have a standalone Java app that has some licensing code that I want
I have the following code in a stand-alone Cocoa test app: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
I need to have my PHP application (its a stand alone, not web-based) connect
I have a stand-alone WinForms application, let's call it Program A. Program A let's
I have built a couple of test cases as stand alone python classes using
I want to make a stand-alone exe with cygwin. I have two options: Staticly
Does MSTest have standalone GUI similar to nUnit that lets me use it and
Flat-file JMS authentication is easy to set up on Glassfish (see http://docs.sun.com/app/docs/doc/821-0027/aeofg?a=view ). The

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.