eXo Kernel :: Component :: Cache Service 2.4.8-GA

org.exoplatform.services.cache.concurrent
Class SynchronizedQueue<I extends Item>

java.lang.Object
  extended by org.exoplatform.services.cache.concurrent.SynchronizedQueue<I>
All Implemented Interfaces:
Queue<I>

public class SynchronizedQueue<I extends Item>
extends Object
implements Queue<I>

Version:
$Revision$
Author:
Julien Viet

Constructor Summary
SynchronizedQueue(Log log)
           
 
Method Summary
 void add(I item)
          Add the item to the head of the list.
 void assertConsistency()
           
 boolean remove(I item)
          Attempt to remove an item from the queue.
 int size()
          Returns the queue size
 ArrayList<I> trim(int size)
          Attempt to trim the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizedQueue

public SynchronizedQueue(Log log)
Method Detail

size

public int size()
Description copied from interface: Queue
Returns the queue size

Specified by:
size in interface Queue<I extends Item>
Returns:
the size

assertConsistency

public void assertConsistency()

remove

public boolean remove(I item)
Attempt to remove an item from the queue.

Specified by:
remove in interface Queue<I extends Item>
Parameters:
item - the item to remove
Returns:
true if the item was removed by this thread

add

public void add(I item)
Add the item to the head of the list.

Specified by:
add in interface Queue<I extends Item>
Parameters:
item - the item to add

trim

public ArrayList<I> trim(int size)
Attempt to trim the queue. Trim will occur if no other thread is already performing a trim and the queue size is greater than the provided size.

Specified by:
trim in interface Queue<I extends Item>
Parameters:
size - the wanted size
Returns:
the list of evicted items

eXo Kernel :: Component :: Cache Service 2.4.8-GA

Copyright © 2014 eXo Platform SAS. All Rights Reserved.