org.zkoss.zkdemo.test
Class DumbFailoverManager

java.lang.Object
  extended by org.zkoss.zkdemo.test.DumbFailoverManager
All Implemented Interfaces:
FailoverManager

public class DumbFailoverManager
extends java.lang.Object
implements FailoverManager

A dumb failover manager useless but to test the failover mechanism.

To test, call dropDesktop(boolean) first to remove a desktop. And, then clicks or enters something on the client to see whether it behaves as usual.

It is usually tested with test/failover.zul.

Author:
tomyeh

Constructor Summary
DumbFailoverManager()
           
 
Method Summary
 void dropDesktop(boolean recoverable)
          Drops the current desktop.
 boolean isRecoverable(Session sess, java.lang.String desktopId)
          Tests whether the specified desktop ID is recoverable.
 void recover(Session sess, Execution exec, Desktop desktop)
          Recovers the specified desktop.
 void start(WebApp wapp)
          Starts the failover manager.
 void stop(WebApp wapp)
          Stops the failover manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DumbFailoverManager

public DumbFailoverManager()
Method Detail

start

public void start(WebApp wapp)
Description copied from interface: FailoverManager
Starts the failover manager.

Specified by:
start in interface FailoverManager

stop

public void stop(WebApp wapp)
Description copied from interface: FailoverManager
Stops the failover manager. Called only if the server is about to stop.

Specified by:
stop in interface FailoverManager

dropDesktop

public void dropDesktop(boolean recoverable)
Drops the current desktop.

Parameters:
recoverable - whether the dropped desktop is recovable.

isRecoverable

public boolean isRecoverable(Session sess,
                             java.lang.String desktopId)
Description copied from interface: FailoverManager
Tests whether the specified desktop ID is recoverable.

Note: when this method called, no execution (Execution) is available. The implementation shall only check whether it is possible to recover the specified desktop ID. Then, do the real recovery in FailoverManager.recover(org.zkoss.zk.ui.Session, org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Desktop).

Specified by:
isRecoverable in interface FailoverManager
Parameters:
sess - the session
desktopId - the desktop ID to recover

recover

public void recover(Session sess,
                    Execution exec,
                    Desktop desktop)
Description copied from interface: FailoverManager
Recovers the specified desktop. It is called only when FailoverManager.isRecoverable(org.zkoss.zk.ui.Session, java.lang.String) returns true. Before calling this method, the desktop and execution Execution) are all prepared.

Note: ZK assumes the failover manager can recover the desktop completely, so it won't update the browser whatever have been done in this method.

During the recovering process, you have to do the following:

Recover Desktop

Recover Page

Specified by:
recover in interface FailoverManager


Copyright © 2005-2009 Potix Corporation. All Rights Reserved.