Class UIPortalCache

java.lang.Object
org.exoplatform.portal.webui.workspace.UIPortalCache

public class UIPortalCache extends Object
The sites a node built, by site key. Each node builds a site from the stored site and keeps its build: a build is never sent to the other nodes. A site created, saved or removed evicts the site's build on every node; a change of the meta site evicts every build on every node, since a displayed site is built inside the meta site's layout. A page is built at each request, so a page change leaves the builds in place.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final long
    Delay, in seconds, of the second eviction of a changed site.
  • Constructor Summary

    Constructors
    Constructor
    Description
    UIPortalCache(org.exoplatform.services.cache.ExoCache<org.exoplatform.portal.mop.SiteKey,UIPortal> cache, Supplier<String> metaPortal, org.exoplatform.container.ExoContainer container)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Evicts the builds of this node only, leaving the other nodes' builds in place: a build found stale on this node says nothing of theirs, and a change made anywhere already evicts every node's build
    void
    evictChanged(org.exoplatform.portal.mop.SiteKey siteKey)
    Evicts, on every node, the builds a change of a site makes stale: the site's own build, or every build when the site is the meta site; then evicts them a second time after SECOND_EVICTION_DELAY seconds
    get(org.exoplatform.portal.mop.SiteKey siteKey)
     
    List<? extends UIPortal>
     
    void
    listenTo(org.exoplatform.services.listener.ListenerService listenerService)
    Listens to the changes of sites made on this node; the evictions they make reach every node
    void
    put(UIPortal uiPortal)
    Keeps a site this node built, without notifying the other nodes: a notified put would evict the other nodes' builds of the site, and each of them would evict this one when it builds the site in turn.
    void
    remove(org.exoplatform.portal.mop.SiteKey siteKey)
    Evicts the build of a site on every node
    void
    Stops the scheduler of the second evictions once the evictions waiting have run: each is meant for the other nodes, which keep running, and the container stops its lifecycle plugins before its caches.
    protected void
    Stops this cache when its container stops.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CACHE_NAME

      public static final String CACHE_NAME
      See Also:
    • SECOND_EVICTION_DELAY

      public static final long SECOND_EVICTION_DELAY
      Delay, in seconds, of the second eviction of a changed site. A node can build the site from the stored site it read before the site's own cache was invalidated there, and keep that build after the first eviction: the two invalidations travel apart. The second eviction removes such a build.
      See Also:
  • Constructor Details

    • UIPortalCache

      public UIPortalCache(org.exoplatform.services.cache.ExoCache<org.exoplatform.portal.mop.SiteKey,UIPortal> cache, Supplier<String> metaPortal, org.exoplatform.container.ExoContainer container)
  • Method Details

    • listenTo

      public void listenTo(org.exoplatform.services.listener.ListenerService listenerService)
      Listens to the changes of sites made on this node; the evictions they make reach every node
      Parameters:
      listenerService - the node's listener service
    • get

      public UIPortal get(org.exoplatform.portal.mop.SiteKey siteKey)
    • put

      public void put(UIPortal uiPortal)
      Keeps a site this node built, without notifying the other nodes: a notified put would evict the other nodes' builds of the site, and each of them would evict this one when it builds the site in turn.
      Parameters:
      uiPortal - the built site
    • remove

      public void remove(org.exoplatform.portal.mop.SiteKey siteKey)
      Evicts the build of a site on every node
      Parameters:
      siteKey - the site's key
    • evictChanged

      public void evictChanged(org.exoplatform.portal.mop.SiteKey siteKey)
      Evicts, on every node, the builds a change of a site makes stale: the site's own build, or every build when the site is the meta site; then evicts them a second time after SECOND_EVICTION_DELAY seconds
      Parameters:
      siteKey - the changed site's key
    • stopWithContainer

      protected void stopWithContainer()
      Stops this cache when its container stops. The container reads its lifecycle plugins in its start and stop, synchronized on itself, but adds them without the lock: the add takes the same lock, the container's own.
    • stop

      public void stop()
      Stops the scheduler of the second evictions once the evictions waiting have run: each is meant for the other nodes, which keep running, and the container stops its lifecycle plugins before its caches. The stop waits up to SECOND_EVICTION_DELAY seconds, and only when a site changed within that delay.
    • clearLocal

      public void clearLocal()
      Evicts the builds of this node only, leaving the other nodes' builds in place: a build found stale on this node says nothing of theirs, and a change made anywhere already evicts every node's build
    • getLocalSites

      public List<? extends UIPortal> getLocalSites()
      Returns:
      the builds of this node only