org.apache.myfaces.view.facelets.pool.impl
Class ViewPoolEntryHolder

java.lang.Object
  extended by org.apache.myfaces.view.facelets.pool.impl.ViewPoolEntryHolder

public class ViewPoolEntryHolder
extends Object

Fast pool using ConcurrentLinkedQueue, with uses an AtomicInteger as count limit. The reasons of design this pool in this way are:

  1. There is no need to put a hard limit about the max number of views stored in the pool. Remember ViewEntry internally has a Soft or Weak reference over the view. The maxCount is just a way to limit the max footprint fo the pool in memory, but if the limit is exceed, the vm can always reclaim the memory space.
  2. View creation is quite fast, so according to previous tests done, include any syncronized method in this code will produce worse performance.

Author:
Leonardo Uribe

Constructor Summary
ViewPoolEntryHolder(int maxCount)
           
 
Method Summary
 boolean add(ViewEntry entry)
           
 int getCount()
           
 boolean isFull()
           
 ViewEntry poll()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewPoolEntryHolder

public ViewPoolEntryHolder(int maxCount)
Method Detail

add

public boolean add(ViewEntry entry)

poll

public ViewEntry poll()

isFull

public boolean isFull()

getCount

public int getCount()


Copyright © 2015 The Apache Software Foundation. All rights reserved.