Blockingqueue: Queue (FIFO)
Blocking queues:
Non-blocking queue:
Arrayblockingqueue: Blocking queues
1, add (object): Adds an object to the queue if the queue can
Holds, returns true, otherwise throws an exception
2. Offer (object): Indicates that if possible, add an object to the
In the queue, if it can be put in, return true, otherwise, return false
3. Put (object): Joins the object to the queue if the queue does not have
Space, the thread that called the secondary method is blocked until there is space in the queue to continue
4. Poll (time): Takes the Element object in the first row of the queue, if
Queue is empty, you can wait for a given time, not an element, and return null
5. Take (): Takes the first element object in the queue, if the queue is empty
Block the thread that called the method until there are elements added to the queue
Blockingqueue: Queue (FIFO)