O'Reilly logo

Java 9 Concurrency Cookbook - Second Edition by Javier Fernández González

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

There's more...

The LinkedTransferQueue class provides other useful methods. The following are some of them:

  • getWaitingConsumerCount(): This method returns the number of consumers that are blocked in the take() method or poll (long timeout, TimeUnit unit) because the LinkedTransferQueue object is empty.
  • hasWaitingConsumer(): This method returns true if the LinkedTransferQueue object has consumers waiting, or false otherwise.
  • offer(E e): This method adds the element passed as a parameter at the end of the LinkedTransferQueue object and returns the true value. E represents the class used to parameterize the declaration of the LinkedTransferQueue class or a subclass of it.
  • peek(): This method returns the first element in the LinkedTransferQueue ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required