Package org.apache.wicket.pageStore
Class AsynchronousPageStore
- java.lang.Object
-
- org.apache.wicket.pageStore.DelegatingPageStore
-
- org.apache.wicket.pageStore.AsynchronousPageStore
-
- All Implemented Interfaces:
IPageStore
public class AsynchronousPageStore extends DelegatingPageStore
Facade forIPageStoremovingaddPage(IPageContext, IManageablePage)to a worker thread.Creates an
AsynchronousPageStore.PendingAddforaddPage(IPageContext, IManageablePage)and puts ito aqueue. LaterAsynchronousPageStore.PageAddingRunnablereads in blocking manner fromqueueand performs the add.It starts only one instance of
AsynchronousPageStore.PageAddingRunnablebecause all we need is to make the page storing asynchronous. We don't want to write concurrently in the wrappedIPageStore, though it may happen in the extreme case when the queue is full. These cases should be avoided.- Author:
- Matej Knopp, manuelbarzi
-
-
Constructor Summary
Constructors Constructor Description AsynchronousPageStore(IPageStore delegate, int capacity)Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPage(IPageContext context, IManageablePage page)Stores the page-voiddestroy()Destroy the store.IManageablePagegetPage(IPageContext context, int pageId)Restores a page from storage.voidremoveAllPages(IPageContext context)All pages should be removed from storage for the given context.voidremovePage(IPageContext context, IManageablePage page)Removes a page from storage.-
Methods inherited from class org.apache.wicket.pageStore.DelegatingPageStore
detach, getDelegate, supportsVersioning
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.wicket.pageStore.IPageStore
canBeAsynchronous
-
-
-
-
Constructor Detail
-
AsynchronousPageStore
public AsynchronousPageStore(IPageStore delegate, int capacity)
Construct.- Parameters:
delegate- the wrappedIPageStorethat actually saved the pagecapacity- the capacity of the queue that delays the saving
-
-
Method Detail
-
destroy
public void destroy()
Description copied from interface:IPageStoreDestroy the store.- Specified by:
destroyin interfaceIPageStore- Overrides:
destroyin classDelegatingPageStore
-
getPage
public IManageablePage getPage(IPageContext context, int pageId)
Description copied from interface:IPageStoreRestores a page from storage.- Specified by:
getPagein interfaceIPageStore- Overrides:
getPagein classDelegatingPageStore- Parameters:
context- the context of the pagepageId- the id of the page.- Returns:
- the page
-
removePage
public void removePage(IPageContext context, IManageablePage page)
Description copied from interface:IPageStoreRemoves a page from storage.- Specified by:
removePagein interfaceIPageStore- Overrides:
removePagein classDelegatingPageStore- Parameters:
context- the context of the page
-
addPage
public void addPage(IPageContext context, IManageablePage page)
Description copied from interface:IPageStoreStores the page-- Specified by:
addPagein interfaceIPageStore- Overrides:
addPagein classDelegatingPageStore- Parameters:
context- the context of the page
-
removeAllPages
public void removeAllPages(IPageContext context)
Description copied from interface:IPageStoreAll pages should be removed from storage for the given context.- Specified by:
removeAllPagesin interfaceIPageStore- Overrides:
removeAllPagesin classDelegatingPageStore- Parameters:
context- the context of the pages
-
-