0

I have two different threads one of which put information into Gemfire region and another one read and remove same information from the same Gemfire region. The problem is: If the second thread is busy the first thread continued to put information into Gemfire region.

What is needed - block first thread if some limit of items in region was reached. It is possible to implement this manualy but may be same mechanism already exists into Gemfire?

Greg Chase
  • 173
  • 8
Light Harut
  • 159
  • 1
  • 1
  • 8

2 Answers2

0

GemFire does not have any kind of blocking queue abstractions so, you are right, you would have to implement this manually. However, I would also ask why you feel the need to be able to throttle GemFire in this way? In case you are concerned about memory consumption you can always configure your regions to overflow to disk either when a specific entry count threshold is reached or when a heap threshold is reached.

Jens D
  • 4,229
  • 3
  • 16
  • 19
0

Dont think gemfire have an option to block put operations but it have option to overflow to disk.

But if you still want to go with blocking option. You can use a CacheListener on your region and can do a size operation and block/sleep operation. Put operation will be blocked till listener is complete.

And you can reuse/remove/add listener component easily.

DhruvG
  • 394
  • 1
  • 2
  • 10