Class UIPortalCache
java.lang.Object
org.exoplatform.portal.webui.workspace.UIPortalCache
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 -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final longDelay, in seconds, of the second eviction of a changed site. -
Constructor Summary
ConstructorsConstructorDescriptionUIPortalCache(org.exoplatform.services.cache.ExoCache<org.exoplatform.portal.mop.SiteKey, UIPortal> cache, Supplier<String> metaPortal, org.exoplatform.container.ExoContainer container) -
Method Summary
Modifier and TypeMethodDescriptionvoidEvicts 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 buildvoidevictChanged(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 afterSECOND_EVICTION_DELAYsecondsget(org.exoplatform.portal.mop.SiteKey siteKey) voidlistenTo(org.exoplatform.services.listener.ListenerService listenerService) Listens to the changes of sites made on this node; the evictions they make reach every nodevoidKeeps 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.voidremove(org.exoplatform.portal.mop.SiteKey siteKey) Evicts the build of a site on every nodevoidstop()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 voidStops this cache when its container stops.
-
Field Details
-
CACHE_NAME
- See Also:
-
SECOND_EVICTION_DELAY
public static final long SECOND_EVICTION_DELAYDelay, 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
-
-
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
-
put
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 afterSECOND_EVICTION_DELAYseconds- 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 toSECOND_EVICTION_DELAYseconds, 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
-