org.apache.cassandra.utils

## Class CoalescingStrategies.CoalescingStrategy

- java.lang.Object
- - org.apache.cassandra.utils.CoalescingStrategies.CoalescingStrategy

Enclosing class:
  CoalescingStrategies

    public abstract static class CoalescingStrategies.CoalescingStrategy
    extends java.lang.Object

### Field Summary

Fields
`protected java.nio.ByteBuffer` `logBuffer`
`protected org.slf4j.Logger` `logger`
`protected org.apache.cassandra.utils.CoalescingStrategies.Parker` `parker`
`protected boolean` `shouldLogAverage`

### Constructor Summary

Constructors
`protected` `CoalescingStrategy(org.apache.cassandra.utils.CoalescingStrategies.Parker parker, org.slf4j.Logger logger, java.lang.String displayName)`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`<C extends CoalescingStrategies.Coalescable> void` `coalesce(java.util.concurrent.BlockingQueue<C> input, java.util.List<C> out, int maxItems)` Drain from the input blocking queue to the output list up to maxItems elements.
`protected abstract <C extends CoalescingStrategies.Coalescable> void` `coalesceInternal(java.util.concurrent.BlockingQueue<C> input, java.util.List<C> out, int maxItems)`
`protected void` `debugGap(long averageGap)`
`protected void` `debugTimestamp(long timestamp)`
`protected <C extends CoalescingStrategies.Coalescable> void` `debugTimestamps(java.util.Collection<C> coalescables)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### parker

    protected final org.apache.cassandra.utils.CoalescingStrategies.Parker parker

#### logger

    protected final org.slf4j.Logger logger

#### shouldLogAverage

    protected volatile boolean shouldLogAverage

#### logBuffer

    protected final java.nio.ByteBuffer logBuffer

### Constructor Detail

#### CoalescingStrategy

    protected CoalescingStrategy(org.apache.cassandra.utils.CoalescingStrategies.Parker parker,
                                 org.slf4j.Logger logger,
                                 java.lang.String displayName)

### Method Detail

#### debugGap

    protected final void debugGap(long averageGap)

#### debugTimestamp

    protected final void debugTimestamp(long timestamp)

#### debugTimestamps

    protected final <C extends CoalescingStrategies.Coalescable> void debugTimestamps(java.util.Collection<C> coalescables)

#### coalesce

    public <C extends CoalescingStrategies.Coalescable> void coalesce(java.util.concurrent.BlockingQueue<C> input,
                                                                      java.util.List<C> out,
                                                                      int maxItems)
                                                               throws java.lang.InterruptedException

Drain from the input blocking queue to the output list up to maxItems elements. The coalescing strategy may choose to park the current thread if it thinks it will be able to produce an output list with more elements.

Parameters:
  `input` - Blocking queue to retrieve elements from
  `out` - Output list to place retrieved elements in. Must be empty.
  `maxItems` - Maximum number of elements to place in the output list
Throws:
  `java.lang.InterruptedException`

#### coalesceInternal

    protected abstract <C extends CoalescingStrategies.Coalescable> void coalesceInternal(java.util.concurrent.BlockingQueue<C> input,
                                                                                          java.util.List<C> out,
                                                                                          int maxItems)
                                                                                   throws java.lang.InterruptedException

Throws:
  `java.lang.InterruptedException`