ConcurrentHashMap wait for key possible?

后端 未结 3 2038
心在旅途
心在旅途 2021-01-13 17:24

i have multithread communication. 1 Thread is dispatching datas to other threads.

Main thread is pushing data:

Main Thread: ConcurrentHashMap map = Glob

3条回答
  •  萌比男神i
    2021-01-13 17:53

    First, call wait() on Thread 1 right before it gets a value from the Map. You could then extend ConcurrentHashMap and override the put() method to notify() Thread 1 when new data is available.

提交回复
热议问题