Do we have anything like only during writing it will be synchronized else behave like ConcurrentHashMap?

Solution Unverified - Updated -

Issue

  • In our current code, when the route is starting it will load the data from table and populate hashmap and we use this data for further processing. Now we have a requirement to check the table for any changes in every 15mins and if any change noted then load the data in hashmap[during that time if any request/thread accessing hashmap should wait and the request should not fail]. Kindly suggest a solution. Please find the current route below.
    route
    from("timer:name?repeatCount=1")
        .setBody(simple("select URL from MSTR"))
        .to("jdbc:mysql-bank?outputType=SelectList")
        .process(populate hashmap...)
  • If I use Collections.synchronizedMap() all read and write operations are synchronized. Do we have anything like only during writing it will be synchronized else behave like ConcurrentHashMap ?

Environment

  • Red Hat JBoss Fuse
    • 6.3.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content