public class AsynchronousPageStore extends Object implements IPageStore
IPageStore
that does the actual saving in worker thread.
Creates an Entry
for each double (sessionId, page) and puts it in entries
queue
if there is room. Acts as producer.
Later PageSavingRunnable
reads in blocking manner from entries
and saves each
entry. Acts as consumer.
PageSavingRunnable
because all we need is to make the page
storing asynchronous. We don't want to write concurrently in the wrapped IPageStore
,
though it may happen in the extreme case when the queue is full. These cases should be avoided.
Based on AsynchronousDataStore (@author Matej Knopp).Constructor and Description |
---|
AsynchronousPageStore(IPageStore delegate,
int capacity)
Deprecated.
Construct.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canBeAsynchronous()
Deprecated.
|
IManageablePage |
convertToPage(Object page)
Deprecated.
Converts a page representation to an instance of
IManageablePage |
void |
destroy()
Deprecated.
Destroy the store.
|
IManageablePage |
getPage(String sessionId,
int pageId)
Deprecated.
Restores a page from the persistent layer.
|
Serializable |
prepareForSerialization(String sessionId,
Serializable page)
Deprecated.
Process the page before the it gets serialized.
|
void |
removePage(String sessionId,
int pageId)
Deprecated.
Removes a page from the persistent layer.
|
Object |
restoreAfterSerialization(Serializable serializable)
Deprecated.
This method should restore the serialized page to intermediate object that can be converted
to real page instance using
IPageStore.convertToPage(Object) . |
void |
storePage(String sessionId,
IManageablePage page)
Deprecated.
Stores the page to a persistent layer.
|
void |
unbind(String sessionId)
Deprecated.
The page store should cleanup all the pages for that sessionid.
|
public AsynchronousPageStore(IPageStore delegate, int capacity)
delegate
- the wrapped IPageStore
that actually saved the pagecapacity
- the capacity of the queue that delays the savingpublic void destroy()
IPageStore
destroy
in interface IPageStore
public IManageablePage getPage(String sessionId, int pageId)
IPageStore
getPage
in interface IPageStore
sessionId
- The session of the page that must be removedpageId
- The id of the page.public void removePage(String sessionId, int pageId)
IPageStore
removePage
in interface IPageStore
sessionId
- The session of the page that must be removedpageId
- The id of the page.public void storePage(String sessionId, IManageablePage page)
IPageStore
storePage
in interface IPageStore
sessionId
- The session of the page that must be removedpage
- The page to storepublic void unbind(String sessionId)
IPageStore
unbind
in interface IPageStore
sessionId
- The session of the page that must be removedpublic Serializable prepareForSerialization(String sessionId, Serializable page)
IPageStore
IPageStore.restoreAfterSerialization(Serializable)
.prepareForSerialization
in interface IPageStore
sessionId
- The session of the page that must be removedpublic Object restoreAfterSerialization(Serializable serializable)
IPageStore
IPageStore.convertToPage(Object)
.restoreAfterSerialization
in interface IPageStore
public IManageablePage convertToPage(Object page)
IPageStore
IManageablePage
convertToPage
in interface IPageStore
page
- some kind of page representationpublic boolean canBeAsynchronous()
canBeAsynchronous
in interface IPageStore
AsynchronousPageStore
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.