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

The Archive Base Latest Questions

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

I have one method under lock (ReentrantLock) this method sending some message to server,

  • 0

I have one method under lock (ReentrantLock) this method sending some message to server, receiving response right away and create/save data in database.
This response have id of message that was send. Client have a listener which is waiting for report from server (this report can return after data send to server), server can also return some kind of report (with id and some status) and I need to map that report (by id) to the previous saved record and change status field for that record.

The problem is that this report can be returned faster (and listener will grab it and try to process) then message from first method is saved in database. What’s the ways to sole that problem?

I had and idea to create additional table in database and save data from message in one table and save data from report to other table. Then synchronize them via some other process, but maybe it is possible to create some buffer/queue where message id will be stored from first method and when we receive report we will check that buffer/queue for corresponding message id and if we found that message id, then that report listener will continue it’s work?

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

    I think it’s best to store report and message separately in the database and link them later on. Supposing your DB does what it’s made for, this reduces the chance of data loss. Additionally, you let the DB do the difficult task of locking/synchronizing, and usually they are quite good at this.

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

Sidebar

Related Questions

Say I have a simple client/server scenario with one method: // client code $client
Okay, I'm losing my mind over this one. I have a method in my
I have one method that opens a file and passes off to another function
I have one method in my managed bean which returns javascript as a string.
I have one combobox on the window form and I have one method which
I have one doubt concerning c# method overloading and call resolution. Let's suppose I
I have a very thin interface that's going to define one method. Should I
I have a button on the window form and and one method I am
I have these two methods on a class that differ only in one method
I'm trying to pass one method to another in elisp, and then have that

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.