当前位置: 首页>>代码示例>>Java>>正文


Java Collections.asLifoQueue方法代码示例

本文整理汇总了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);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:32,代码来源:UIXDocumentTemplate.java

示例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);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:31,代码来源:HtmlBodyTemplate.java

示例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() });
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:16,代码来源:ComponentContextManagerImpl.java

示例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));
}
 
开发者ID:zhangjunfang,项目名称:util,代码行数:11,代码来源:QueueUtil.java

示例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());
}
 
开发者ID:zhangjunfang,项目名称:util,代码行数:12,代码来源:QueueUtil.java


注:本文中的java.util.Collections.asLifoQueue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。