So I use the fixed size BlockingQueue [ArrayBlockingQueue] in the producer / consumer application, but I want the user to be able to resize the queue on the fly. The problem is that the implementation of BlockingQueue does not allow changing the capacity after creation. Has anyone ever come across this before? Any ideas?
The most obvious solution (it may or may not be appropriate depending on your circumstances) would be to simply create a new queue with updated bandwidth. Then pull everything from the old queue to the new queue.
You can extend LinkedBlockingQueue. Its limit is a soft limit (i.e., just an additional check), and you can do it that you can change (by disabling the built-in one and placing your own).
Source: https://habr.com/ru/post/892158/More articles:How to use C # BackgroundWorker to report progress in native C ++ code? - c ++Convert int to unsigned short java - javaC # Regex - remove decimal point, if not between two digits - c #Changing special characters in a Delphi array - arraysReplace diacritics around the world - phpSelf-organizing cards Vs k-mean - k-meansCannot find module "Socket.IO- node" when trying to start a node.js project - javascriptHow to write a clean makefile? - makefileWhy declare a reference to an instance of the final class as final? - javaTextView: make it crop without respect for spaces between words - androidAll Articles