org.infinispan.container
Class FIFOSimpleDataContainer

java.lang.Object
  extended by org.infinispan.container.SimpleDataContainer
      extended by org.infinispan.container.FIFOSimpleDataContainer
All Implemented Interfaces:
Iterable<InternalCacheEntry>, DataContainer
Direct Known Subclasses:
LRUSimpleDataContainer

@ThreadSafe
public class FIFOSimpleDataContainer
extends SimpleDataContainer

Based on the same techniques outlined in the SimpleDataContainer, this implementation always forces the collection of creation timestamps for entries. This means that ImmortalCacheEntry and TransientCacheEntry are never used, since only MortalCacheEntry and TransientMortalCacheEntry instances capture timestamps.

All gets, puts, etc are constant time operations.

Iteration incurs a O(N log(N)) cost since the timestamps are sorted first, and there is an added memory overhead in temporary space to hold sorted references. When sorting, this implementation does not use the millisecond granularity when ordering timestamps; instead it defaults to a 1-second granularity since the FIFO ordering does not need to be strict and the TimSort implementation used for sorting performs significantly better with minimal reordering offered by a coarser granularity.

Since:
4.0
Author:
Manik Surtani

Constructor Summary
FIFOSimpleDataContainer(int concurrencyLevel)
           
FIFOSimpleDataContainer(int concurrencyLevel, int timestampGranularity)
           
 
Method Summary
 Iterator<InternalCacheEntry> iterator()
           
 
Methods inherited from class org.infinispan.container.SimpleDataContainer
clear, containsKey, entrySet, get, keySet, peek, purgeExpired, put, remove, size, successfulPut, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FIFOSimpleDataContainer

public FIFOSimpleDataContainer(int concurrencyLevel)

FIFOSimpleDataContainer

public FIFOSimpleDataContainer(int concurrencyLevel,
                               int timestampGranularity)
Method Detail

iterator

public Iterator<InternalCacheEntry> iterator()
Specified by:
iterator in interface Iterable<InternalCacheEntry>
Overrides:
iterator in class SimpleDataContainer

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.