Which collection supports multiple simultaneous inserts?

We are developing a Java application with multiple workflows. These threads will have to deliver a lot of calculation results to our user interface thread. The order of delivery of the results does not matter.

Right now, all threads are simply pushing the results onto the synchronized stack - but that means that each thread has to wait for the other threads before the results are delivered.

Is there a data structure that supports simultaneous insertions with each pad over time?

Thank,

Martin

+3
source share
5 answers

ConcurrentLinkedQueue . , , , .

ArrayBlockingQueue , .

: , . Simultaneuos? (, ArrayBlockingQueue), . , Queue.

+10

- , .

, ? , , ( ), , , - , , , .

+3

, . , : ?

, , - , . , Swing, , , SwingWorker.

+1

java.util.concurrent.ConcurrentLinkedQueue, java.util.concurrent.ConcurrentHashMap java.util.concurrent.ConcurrentSkipListSet. , . ConcurrentSkipListSet, , , log (n) contains, add remove . , . "

0

, , , , -

  • , , . , . ( , ), ( ).

  • , Lock.tryLock(). , . , .

0

Source: https://habr.com/ru/post/1751196/


All Articles