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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:56:09+00:00 2026-05-28T04:56:09+00:00

Here is a situation I have encountered: I have two similair java application running

  • 0

Here is a situation I have encountered: I have two similair java application running on different servers. Both applications obtain data from the same website using web-service provided. But the site doesn’t know of course that the first app has taken the same peace of data as the second app. After fetching data should be saved in database. So I have a problem of saving the same data two times in a database.

How can I avoid duplicate entries in my db?

Probably there are two ways:

1) use database side. write something that looks like “insert if unique”.

2) use server side. write some intermediate service that will receive responses from two data fetchers and process them somehow.

I suppose second solution is more effecient.

Can you advice something on this topic?
How would you implement that intermediate service? How would implement communication between the services? If we would use the HashMaps to store received data, how can we estimate maximum size of HashMap that our system can handle?

  • 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-28T04:56:09+00:00Added an answer on May 28, 2026 at 4:56 am

    Do you really need to fetch data at two servers simultaneously? Checking every entry during insert if not present could be expensive. Merging several fetches can be time consuming as well. Is there any benefit of fetching in parallel? Consider having one fetcher at time.

    The problem you will face is that you have to choose which one of you distributed processes should perform data fetching and storing it in DB.

    It is some kind of Leader Election problem.

    Take a look at Apache ZooKeeper which is distributed coordination service.
    There is a receipt how to implement leader election with ZooKeeper.

    There are a lot of frameworks that already implemented this receipt. I’d recommend you to use Netflix curator. More details about the leader election with curator is available at wiki.

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

Sidebar

Related Questions

Here is my situation: I have an application that use a configuration file. The
Here is situation: I have two projects. ConsoleApp and Class Library. Console app references
I have worked with various applications and encountered this situation many times. Until now
Here's my situation: I have a Data Template set up which contains a ToggleButton
Here's the situation: I have a web-based ticket application, multiple users. One problem that
Here is my situation - I have two nested view models: <%=Html.EditorFor(x => x.DisplayEntitiesWithRadioboxesViewModel)%><br
Here's the situation: I have two DateTimePicker controls for the start date and end
Here's the situation: I have a label's text set, immediately followed by a response.redirect()
Here is the situation: I have been called upon to work with InstallAnywhere 8,
Here's the situation: we have an Oracle database we need to connect to to

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.