Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8236580

LinkedBlockingQueue - Add ability to change capacity

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      jdk-13.0.1

      A DESCRIPTION OF THE PROBLEM :
      Hi,

      Please add the option to change the capacity of LinkedBlockingQueue (and possibly other BlockingQueue implementations).

      Changing the capacity after instantiation of the queue can allow the program to adjust the queue size based on the actual throughput and thus improve the system performance.

      For example, consider the following use case:
      Thread A sends HTTP requests and puts the responses in a queue.
      Thread B reads from the queue and writes the responses to DB.

      The HTTP latency and the DB access latency depend on various factors and the system can detect those at runtime and adjust the queue size accordingly.

      It seems that making this change in LinkedBlockingQueue is relatively easy but trying to add this ability from the outside by extending the class is impossible without duplicating large chunks of the code.

      A discussion about a resizeable queue can be found here - https://stackoverflow.com/questions/6600023/re-sizeable-java-blockingqueue

      Thanks!


        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: