ch.qos.logback.core.spi
Interface CyclicBufferTracker<E>

All Known Implementing Classes:
CyclicBufferTrackerImpl

public interface CyclicBufferTracker<E>

An interface for tracking cyclic buffers by key.

Author:
Ceki Gücü

Field Summary
static int DEFAULT_BUFFER_SIZE
           
static int DEFAULT_NUMBER_OF_BUFFERS
           
static int THRESHOLD
           
 
Method Summary
 void clearStaleBuffers(long now)
          Clear (and detach) buffers which are stale.
 int getBufferSize()
           
 int getMaxNumberOfBuffers()
           
 CyclicBuffer<E> getOrCreate(String key, long timestamp)
          Get the cyclic buffer identified by 'key', updating its timestamp in the process.
 void removeBuffer(String key)
          Remove a cyclic buffer identified by its key.
 void setBufferSize(int size)
           
 void setMaxNumberOfBuffers(int maxNumBuffers)
          Set the maximum number of tracked buffers.
 int size()
          The size of the internal map/list/collection holding the cyclic buffers.
 

Field Detail

DEFAULT_BUFFER_SIZE

static final int DEFAULT_BUFFER_SIZE
See Also:
Constant Field Values

DEFAULT_NUMBER_OF_BUFFERS

static final int DEFAULT_NUMBER_OF_BUFFERS
See Also:
Constant Field Values

THRESHOLD

static final int THRESHOLD
See Also:
Constant Field Values
Method Detail

getBufferSize

int getBufferSize()

setBufferSize

void setBufferSize(int size)

getMaxNumberOfBuffers

int getMaxNumberOfBuffers()

setMaxNumberOfBuffers

void setMaxNumberOfBuffers(int maxNumBuffers)
Set the maximum number of tracked buffers. After reaching the maximum number of buffers, the creation of a new buffer implies the removal of the least recently used buffer.

Parameters:
maxNumBuffers -

getOrCreate

CyclicBuffer<E> getOrCreate(String key,
                            long timestamp)
Get the cyclic buffer identified by 'key', updating its timestamp in the process. If there is no such buffer, create it. If the current number of buffers is above or equal to 'maxNumBuffers' then the least recently accessed buffer is removed.

Parameters:
key -
timestamp -
Returns:

removeBuffer

void removeBuffer(String key)
Remove a cyclic buffer identified by its key.


clearStaleBuffers

void clearStaleBuffers(long now)
Clear (and detach) buffers which are stale.

Parameters:
now -

size

int size()
The size of the internal map/list/collection holding the cyclic buffers.

Returns:
size of internal collection


Copyright © 2005-2012 QOS.ch. All Rights Reserved.