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.
 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 bufferSize)
           
 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 bufferSize)
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>

getOrCreate

public CyclicBuffer<E> getOrCreate(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:
getOrCreate in interface CyclicBufferTracker<E>
Returns:

removeBuffer

public void removeBuffer(String key)
Description copied from interface: CyclicBufferTracker
Remove a cyclic buffer identified by its key.

Specified by:
removeBuffer in interface CyclicBufferTracker<E>

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-2012 QOS.ch. All Rights Reserved.