本文整理汇总了Java中java.util.Collections.asLifoQueue方法的典型用法代码示例。如果您正苦于以下问题:Java Collections.asLifoQueue方法的具体用法?Java Collections.asLifoQueue怎么用?Java Collections.asLifoQueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Collections
的用法示例。
在下文中一共展示了Collections.asLifoQueue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupVisitingContext
import java.util.Collections; //导入方法依赖的package包/类
/**
* Suspends any context changes before allowing invokeOnComponent or visitTree calls to continue,
* allowing components to undo any context changes during a re-entrant call.
* @param facesContext the faces context
* @see ComponentContextManager#suspend(FacesContext)
*/
@Override
protected void setupVisitingContext(FacesContext facesContext)
{
ComponentContextManager ctxMgr = RequestContext.getCurrentInstance()
.getComponentContextManager();
// Suspend any current component context during a visit tree for re-entrant
// component tree processing
SuspendedContextChanges suspendedChanges = ctxMgr.suspend(facesContext);
Map<String, Object> reqMap = facesContext.getExternalContext().getRequestMap();
@SuppressWarnings("unchecked")
Queue<SuspendedContextChanges> suspendedChangesQueue = (Queue<SuspendedContextChanges>)
reqMap.get(_SUSPENDED_CHANGES_KEY);
if (suspendedChangesQueue == null)
{
suspendedChangesQueue = Collections.asLifoQueue(new ArrayDeque<SuspendedContextChanges>());
reqMap.put(_SUSPENDED_CHANGES_KEY, suspendedChangesQueue);
}
suspendedChangesQueue.offer(suspendedChanges);
_LOG.fine("UIXDocument suspended context changes in setupVisitingContext");
super.setupVisitingContext(facesContext);
}
示例2: setupVisitingContext
import java.util.Collections; //导入方法依赖的package包/类
/**
* Suspends any context changes before allowing invokeOnComponent or visitTree calls to continue,
* allowing components to undo any context changes during a re-entrant call.
* @param facesContext the faces context
* @see ComponentContextManager#suspend(FacesContext)
*/
@Override
protected void setupVisitingContext(FacesContext facesContext)
{
ComponentContextManager ctxMgr = RequestContext.getCurrentInstance()
.getComponentContextManager();
// Suspend any current component context during a visit tree for re-entrant
// component tree processing
SuspendedContextChanges suspendedChanges = ctxMgr.suspend(facesContext);
Map<String, Object> reqMap = facesContext.getExternalContext().getRequestMap();
@SuppressWarnings("unchecked")
Queue<SuspendedContextChanges> suspendedChangesQueue = (Queue<SuspendedContextChanges>)
reqMap.get(_SUSPENDED_CHANGES_KEY);
if (suspendedChangesQueue == null)
{
suspendedChangesQueue = Collections.asLifoQueue(new ArrayDeque<SuspendedContextChanges>());
reqMap.put(_SUSPENDED_CHANGES_KEY, suspendedChangesQueue);
}
suspendedChangesQueue.offer(suspendedChanges);
super.setupVisitingContext(facesContext);
}
示例3: pushChange
import java.util.Collections; //导入方法依赖的package包/类
public void pushChange(ComponentContextChange change)
{
if (_stack == null)
{
_stack = Collections.asLifoQueue(new ArrayDeque<ComponentContextChange>());
}
_stack.offer(change);
if (_LOG.isFine())
{
_LOG.fine("Component context change pushed onto the stack. Change: {0}. New stack size: {1}",
new Object[] { change, _stack.size() });
}
}
示例4: createStack
import java.util.Collections; //导入方法依赖的package包/类
/**
* 支持后进先出的栈,用ArrayDeque实现, 经过Collections#asLifoQueue()转换顺序
*
* 需设置初始长度,默认为16,数组满时成倍扩容
*
* @see Collections#asLifoQueue()
*/
public static <E> Queue<E> createStack(int initSize) {
return Collections.asLifoQueue(new ArrayDeque<E>(initSize));
}
示例5: createConcurrentStack
import java.util.Collections; //导入方法依赖的package包/类
/**
* 支持后进先出的并发栈,用ConcurrentLinkedDeque实现,经过Collections#asLifoQueue()转换顺序
*
* 另对于BlockingQueue接口, JDK暂无Lifo倒转实现,因此只能直接使用未调转顺序的LinkedBlockingDeque
*
* @see Collections#asLifoQueue()
*/
@SuppressWarnings("unchecked")
public static <E> Queue<E> createConcurrentStack() {
return (Queue<E>) Collections.asLifoQueue(newConcurrentNonBlockingDeque());
}