Package org.zkoss.zk.ui.impl

## Class SessionDesktopCacheProvider

- java.lang.Object
- - org.zkoss.zk.ui.impl.SessionDesktopCacheProvider

- All Implemented Interfaces:
    `DesktopCacheProvider`

      public class SessionDesktopCacheProvider
      extends java.lang.Object
      implements DesktopCacheProvider

  A implementation of `DesktopCacheProvider` that stores all desktops from the same session in one desktop cache.

  Implementation Note: we don't store the desktop cache in the session's attribute (rather, we use `SessionCtrl.setDesktopCache(org.zkoss.zk.ui.sys.DesktopCache)`. Reason: the desktop cache is serialized only if the session is serializable.

  Author:
    tomyeh
  See Also:
    `GlobalDesktopCacheProvider`

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SessionDesktopCacheProvider()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `DesktopCache` | `getDesktopCache​(Session sess)` | Returns a desktop cache of the specified session.
    `void` | `sessionDestroyed​(Session sess)` | Called when a session is destroyed.
    `void` | `sessionDidActivate​(Session sess)` | Invokes `getDesktopCache(org.zkoss.zk.ui.Session)`'s `DesktopCache.sessionDidActivate(org.zkoss.zk.ui.Session)`.
    `void` | `sessionWillPassivate​(Session sess)` | Invokes `getDesktopCache(org.zkoss.zk.ui.Session)`'s `DesktopCache.sessionWillPassivate(org.zkoss.zk.ui.Session)`.
    `void` | `start​(WebApp wapp)` | Starts the provider.
    `void` | `stop​(WebApp wapp)` | Stops the provider.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SessionDesktopCacheProvider

          public SessionDesktopCacheProvider()

  - ### Method Detail

    - #### getDesktopCache

          public DesktopCache getDesktopCache​(Session sess)

      Description copied from interface: `DesktopCacheProvider`
      Returns a desktop cache of the specified session.

      The implementation might ignore session and use a global cache instead. Moreover, it might implement a cache supporting clustering.

      Specified by:
        `getDesktopCache` in interface `DesktopCacheProvider`

    - #### sessionDestroyed

          public void sessionDestroyed​(Session sess)

      Description copied from interface: `DesktopCacheProvider`
      Called when a session is destroyed. If the provider is session-based, it has to remove relevant desktops. If not, it might ignore this method.

      Application shall never access this method.

      Specified by:
        `sessionDestroyed` in interface `DesktopCacheProvider`

    - #### sessionWillPassivate

          public void sessionWillPassivate​(Session sess)

      Invokes `getDesktopCache(org.zkoss.zk.ui.Session)`'s `DesktopCache.sessionWillPassivate(org.zkoss.zk.ui.Session)`.
      Specified by:
        `sessionWillPassivate` in interface `DesktopCacheProvider`

    - #### sessionDidActivate

          public void sessionDidActivate​(Session sess)

      Invokes `getDesktopCache(org.zkoss.zk.ui.Session)`'s `DesktopCache.sessionDidActivate(org.zkoss.zk.ui.Session)`.
      Specified by:
        `sessionDidActivate` in interface `DesktopCacheProvider`

    - #### start

          public void start​(WebApp wapp)

      Description copied from interface: `DesktopCacheProvider`
      Starts the provider.
      Specified by:
        `start` in interface `DesktopCacheProvider`

    - #### stop

          public void stop​(WebApp wapp)

      Description copied from interface: `DesktopCacheProvider`
      Stops the provider.
      Specified by:
        `stop` in interface `DesktopCacheProvider`