ch.qos.logback.core.spi
Class CyclicBufferTrackerImpl<E>

java.lang.Object
  extended by ch.qos.logback.core.spi.CyclicBufferTrackerImpl<E>
All Implemented Interfaces:
CyclicBufferTracker<E>

public class CyclicBufferTrackerImpl<E>
extends Object
implements CyclicBufferTracker<E>

Author:
Ceki Gücü

Field Summary
 
Fields inherited from interface ch.qos.logback.core.spi.CyclicBufferTracker
DEFAULT_BUFFER_SIZE, DEFAULT_NUMBER_OF_BUFFERS, THRESHOLD
 
Constructor Summary
CyclicBufferTrackerImpl()
           
 
Method Summary
 void clearStaleBuffers(long now)
          Clear (and detach) buffers which are stale.
 CyclicBuffer<E> get(String key, long timestamp)
          Get the cyclic buffer identified by 'key', updating its timestamp in the process.
 int getBufferSize()
           
 int getMaxNumberOfBuffers()
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CyclicBufferTrackerImpl

public CyclicBufferTrackerImpl()
Method Detail

getBufferSize

public int getBufferSize()
Specified by:
getBufferSize in interface CyclicBufferTracker<E>

setBufferSize

public void setBufferSize(int size)
Specified by:
setBufferSize in interface CyclicBufferTracker<E>

getMaxNumberOfBuffers

public int getMaxNumberOfBuffers()
Specified by:
getMaxNumberOfBuffers in interface CyclicBufferTracker<E>

setMaxNumberOfBuffers

public void setMaxNumberOfBuffers(int maxNumBuffers)
Description copied from interface: CyclicBufferTracker
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.

Specified by:
setMaxNumberOfBuffers in interface CyclicBufferTracker<E>

get

public CyclicBuffer<E> get(String key,
                           long timestamp)
Description copied from interface: CyclicBufferTracker
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.

Specified by:
get in interface CyclicBufferTracker<E>
Returns:

clearStaleBuffers

public void clearStaleBuffers(long now)
Description copied from interface: CyclicBufferTracker
Clear (and detach) buffers which are stale.

Specified by:
clearStaleBuffers in interface CyclicBufferTracker<E>

size

public int size()
Description copied from interface: CyclicBufferTracker
The size of the internal map/list/collection holding the cyclic buffers.

Specified by:
size in interface CyclicBufferTracker<E>
Returns:
size of internal collection


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