The Disruptor Framework: A Concurrency Framework for Java
Let’s start with the basic question: What is the disruptor? The disruptor is a concurrency framework for Java that allows data sharing between threads. The age old way of coding a producer-consumer model is to use a queue as the buffer area between the producer and the consumer, where the producer adds data objects to the queue, which are in turn processed by the consumer. However, such a model does not work well at the hardware level and ends up being highly inefficient. The disruptor in its simplest form replaces the queue with a data structure known as the ‘ring buffer’. Which brings us to the next question, what is the ring buffer? The ring buffer is an array of fixed length (which must be a power of 2), it’s circular and wraps. This data structure is at the core of what makes the disruptor super fast.
Subscribe to Applenews247.Com Newsletter