@Override
public ViewEntry popStaticOrPartialStructureView(FacesContext context, UIViewRoot root)
{
MetadataViewKey key = deriveViewKey(context, root);
ViewEntry entry = popStaticStructureView(context, key);
if (entry != null)
{
entry.setResult(RestoreViewFromPoolResult.COMPLETE);
}
else
{
entry = popPartialStructureView(context, key);
if (entry != null)
{
entry.setResult(RestoreViewFromPoolResult.REFRESH_REQUIRED);
}
else
{
Map<DynamicViewKey, ViewPoolEntryHolder> map = dynamicStructureViewPool.get(key);
if (map != null)
{
try
{
ViewPoolEntryHolder maxEntry = null;
long max = -1;
for (Iterator<ViewPoolEntryHolder> it = map.values().iterator(); it.hasNext();)
{
ViewPoolEntryHolder e = it.next();
long count = e.getCount();
if (count > max && count > dynamicPartialLimit)
{
maxEntry = e;
max = count;
}
}
if (maxEntry != null)
{
entry = maxEntry.poll();
if (entry != null)
{
do
{
if (entry.activate())
{
break;
}
entry = maxEntry.poll();
}
while (entry != null);
if (entry != null)
{
entry.setResult(RestoreViewFromPoolResult.REFRESH_REQUIRED);
}
}
}
}
catch(ConcurrentModificationException ex)