|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.pageStore.AsynchronousDataStore
public class AsynchronousDataStore
Facade for IDataStore
that does the actual saving in worker thread.
Creates an Entry
for each triple (sessionId, pageId, data) 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 IDataStore
,
though it may happen in the extreme case when the queue is full. These cases should be avoided.
Constructor Summary | |
---|---|
AsynchronousDataStore(IDataStore dataStore,
int capacity)
Construct. |
Method Summary | |
---|---|
boolean |
canBeAsynchronous()
|
void |
destroy()
Properly close the data store and possibly open resource handles |
byte[] |
getData(String sessionId,
int id)
Get data associated with the session id and page id. |
boolean |
isReplicated()
|
void |
removeData(String sessionId)
Remove all page data for the session id |
void |
removeData(String sessionId,
int id)
Remove all persisted data related to the session id and page id |
void |
storeData(String sessionId,
int id,
byte[] data)
Save the entry in the queue if there is a room or directly pass it to the wrapped IDataStore if there is no such |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AsynchronousDataStore(IDataStore dataStore, int capacity)
dataStore
- the wrapped IDataStore
that actually saved the datacapacity
- the capacity of the queue that delays the savingMethod Detail |
---|
public void destroy()
IDataStore
destroy
in interface IDataStore
IDataStore.destroy()
public byte[] getData(String sessionId, int id)
IDataStore
getData
in interface IDataStore
sessionId
- Session IDid
- Page ID
IDataStore.getData(java.lang.String, int)
public boolean isReplicated()
isReplicated
in interface IDataStore
IDataStore.isReplicated()
public void removeData(String sessionId, int id)
IDataStore
removeData
in interface IDataStore
sessionId
- Session IDid
- Page IDIDataStore.removeData(java.lang.String, int)
public void removeData(String sessionId)
IDataStore
removeData
in interface IDataStore
sessionId
- Session IDIDataStore.removeData(java.lang.String)
public void storeData(String sessionId, int id, byte[] data)
IDataStore
if there is no such
storeData
in interface IDataStore
sessionId
- Session IDid
- Page IDdata
- Page dataIDataStore.storeData(java.lang.String, int, byte[])
public final boolean canBeAsynchronous()
canBeAsynchronous
in interface IDataStore
AsynchronousDataStore
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |