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 forIPageStore
movingaddPage(IPageContext, IManageablePage)
to a worker thread.Creates an
AsynchronousPageStore.PendingAdd
foraddPage(IPageContext, IManageablePage)
and puts ito aqueue
. LaterAsynchronousPageStore.PageAddingRunnable
reads in blocking manner fromqueue
and performs the add.It starts only one instance of
AsynchronousPageStore.PageAddingRunnable
because 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 void
addPage(IPageContext context, IManageablePage page)
Stores the page-void
destroy()
Destroy the store.IManageablePage
getPage(IPageContext context, int pageId)
Restores a page from storage.void
removeAllPages(IPageContext context)
All pages should be removed from storage for the given context.void
removePage(IPageContext context, IManageablePage page)
Removes a page from storage.-
Methods inherited from class org.apache.wicket.pageStore.DelegatingPageStore
detach, end, getDelegate, revertPage, 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 wrappedIPageStore
that actually saved the pagecapacity
- the capacity of the queue that delays the saving
-
-
Method Detail
-
destroy
public void destroy()
Description copied from interface:IPageStore
Destroy the store.- Specified by:
destroy
in interfaceIPageStore
- Overrides:
destroy
in classDelegatingPageStore
-
getPage
public IManageablePage getPage(IPageContext context, int pageId)
Description copied from interface:IPageStore
Restores a page from storage.- Specified by:
getPage
in interfaceIPageStore
- Overrides:
getPage
in 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:IPageStore
Removes a page from storage.- Specified by:
removePage
in interfaceIPageStore
- Overrides:
removePage
in classDelegatingPageStore
- Parameters:
context
- the context of the pagepage
- the page.
-
addPage
public void addPage(IPageContext context, IManageablePage page)
Description copied from interface:IPageStore
Stores the page-- Specified by:
addPage
in interfaceIPageStore
- Overrides:
addPage
in classDelegatingPageStore
- Parameters:
context
- the context of the pagepage
- the page.
-
removeAllPages
public void removeAllPages(IPageContext context)
Description copied from interface:IPageStore
All pages should be removed from storage for the given context.- Specified by:
removeAllPages
in interfaceIPageStore
- Overrides:
removeAllPages
in classDelegatingPageStore
- Parameters:
context
- the context of the pages
-
-