org.zkoss.zk.ui.Desktop.isAlive()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中org.zkoss.zk.ui.Desktop.isAlive()方法的一些代码示例,展示了Desktop.isAlive()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Desktop.isAlive()方法的具体详情如下:
包路径:org.zkoss.zk.ui.Desktop
类名称:Desktop
方法名:isAlive

Desktop.isAlive介绍

[英]Returns whether the desktop is still alive. It returns false once it is destroyed.
[中]返回桌面是否仍处于活动状态。一旦被销毁,它将返回false。

代码示例

代码示例来源:origin: org.zkoss.zk/zk

boolean bDead = _desktop == null || !_desktop.isAlive();
if (bTimeout || bDead) { //not timeout

代码示例来源:origin: org.zkoss.zk/zk

public void stop() {
  if (_desktop == null) {
    log.warn("Ignored: Sever-push not started");
    return;
  }
  final Execution exec = Executions.getCurrent();
  final boolean inexec = exec != null && exec.getDesktop() == _desktop;
  //it might be caused by DesktopCache expunge (when creating another desktop)
  try {
    if (inexec && _desktop.isAlive()) //Bug 1815480: don't send if timeout
      stopClientPush();
  } finally {
    _desktop = null; //to cause DesktopUnavailableException being thrown
    wakePending();
    //if inexec, either in working thread, or other event listener
    //if in working thread, we cannot notify here (too early to wake).
    //if other listener, no need notify (since onPiggyback not running)
    if (!inexec) {
      synchronized (_mutex) {
        _mutex.notify(); //wake up onPiggyback
      }
    }
  }
}

代码示例来源:origin: org.zkoss.zk/zkex

boolean bDead = _desktop == null || !_desktop.isAlive();
if (bTimeout || bDead) { //not timeout

代码示例来源:origin: org.zkoss.zk/zkmax

boolean bDead = _desktop == null || !_desktop.isAlive();
if (bTimeout || bDead) { //not timeout

代码示例来源:origin: org.zkoss.zk/zkex

/**
 * Terminate a {@linkplain OperationThread} which is stored in desktop and clear it.
 * 
 * @param desktop the associated desktop
 */
public static void destroyWith(Desktop desktop) {
  if (desktop == null){
    throw new NullPointerException("desktop is null");
  }
  if(D.ON && log.debugable()){
    log.debug("destory a Operation Thread for desktop:"+desktop);
  }
  synchronized(desktop) {
    if (desktop.isAlive()) {// destroy desktop if it still alive.
      OperationThread t = (OperationThread) desktop
          .getAttribute(DESKTOP_KEY);
      desktop.removeAttribute(DESKTOP_KEY);
      if (t != null && t.isRunning()) {
        t.terminate();
      }
      
    }
  }
}

代码示例来源:origin: org.zkoss.zk/zkex

/**
 * Get the {@link OperationQueue} of {@linkplain OperationThread},
 * It is check is there any {@linkplain OperationThread} exist in desktop.
 * If no, create one ,start it and store in desktop, then return thread's operation queue.
 * If yes, return operation queue directly.  
 * 
 * There is only one {@linkplain OperationThread} in each desktop.
 * @param desktop the associated desktop
 * @return a queue which associate to desktop
 */
public static OperationQueue getQueue(Desktop desktop) {
  if (desktop == null)
    throw new NullPointerException("desktop is null");
  synchronized(desktop) {
    if (!desktop.isAlive()) {
      throw new IllegalStateException("desktop not alive:" + desktop);
    }
    OperationThread t = (OperationThread) desktop.getAttribute(DESKTOP_KEY);
    if (t == null) {
      t = new OperationThread(desktop);
      if(D.ON && log.debugable()){
        log.debug("staring a Operation Thread for desktop:"+desktop+",name="+t.getName());
      }
      desktop.setAttribute(DESKTOP_KEY, t);
      t.start();
      
    }
    return t.getQueue();
  }
}

代码示例来源:origin: org.zkoss.zk/zk

if (page == null || !page.isAlive()) {
  String msg = (page == null ? "No page is available in " + desktop : "Page " + page + " was destroyed");
  if (desktop.isAlive())
    msg += " (but desktop is alive)";
  else

代码示例来源:origin: org.zkoss.zk/zk

synchronized (uvlock) {
  for (boolean tried = false;;) {
    if (!desktop.isAlive())
      throw new org.zkoss.zk.ui.DesktopUnavailableException(
          "Unable to activate destroyed desktop, " + desktop);

代码示例来源:origin: org.zkoss.zk/zkex

int failCount = 0;
while (_running) {
  if(!_desktop.isAlive()){
    throw new DesktopUnavailableException(
        "Desktop is not alive"+_desktop);

相关文章