2

Hi I am a new user of Chronicle Products and till now documentation/usage looks pretty smooth.

Though I have a question when Map data is shared across JVM's on the same host does consumer JVM waiting on the data receive any sort of callback or signal when the data arrives or do we need to implement custom callback mechanism.

Thoughts?

ATO
  • 574
  • 4
  • 14
  • 1
    What do you mean by "data arrives"? Callback on what specifically? – leventov Aug 24 '17 at 07:00
  • 1
    Hi @leventov the question is - When the JVM1(Consumer) does an insert into the map, how will JVM2(Producer) which has Map's reference be notified that data has been inserted. Is frequently polling the map size an option for JVM2? Is there any other approach which you guys recommend? – ATO Aug 24 '17 at 17:28
  • There is no such mechanism inside Chronicle Map and there couldn't be, by design. Yes, you can frequently poll a Map, but I doubt this is reasonable comparing to sending proper messages between the processes, using OS mechanisms like channels, or libs like Chronicle Queue, or zeroMq, or whatever. – leventov Aug 24 '17 at 17:38
  • 1
    Do you either need to redesign your app, or Chronicle Map doesn't fit into it as a communication tool. – leventov Aug 24 '17 at 17:39
  • 1
    I understand that there is no mechanism within Chronicle Product to manage that. I was just wondering what you guys suggest in terms of implementation. Though thanks for prompt reply. – ATO Aug 24 '17 at 18:26

1 Answers1

2

Thank you for you question about Chronicle Software products.

There is no callback/notification mechanism in the use-case you describe.

Maps shared between multiple JVMs on the same host 'communicate' using shared memory, not any kind of eventing mechanism. When you write to map A from JVM 1, if JVM 2 also has a reference to map A (i.e. a Map instance created from the same backing file), then it will see the update automatically, because the two map instances are sharing the same region of mapped memory.

I hope this answers your question.

Best Regards, Terry

  • 1
    Thanks for your comment. What I am saying is when the JVM1 does an insert into the map, how will JVM2 which has Map's reference be notified that data has been inserted. Is frequently polling the map size an option for JVM2? – ATO Aug 24 '17 at 13:07
  • Is there any online Sample which I can refer to? – ATO Aug 24 '17 at 13:11
  • ATO, https://github.com/OpenHFT/Chronicle-Map is the link to the Repo and ReadMe file. The SO user named leventov (who asked you a question above) would be the best to dialogue with since he is the author of Chronicle-Map. Best Regards, Terry – Terry Williams Aug 24 '17 at 17:01