public class PublishStore extends BlockPublishStore
The PublishStore class provides a robust foundation for implementing features such as tracking unacknowledged messages and ensuring message persistence.
BlockPublishStore.Buffer, BlockPublishStore.ByteSequenceStore.StoreReplayer_buffer, _errorOnPublishGap, _resizeHandler, AMPS_MIN_PUB_STORE_DISCARDED_VERSION, METADATA_LAST_DISCARDED_LOCATION, METADATA_VERSION_LOCATIONSOWDeleteByBookmark, SOWDeleteByBookmarkCancel, SOWDeleteByData, SOWDeleteByFilter, SOWDeleteByKeys| Constructor and Description |
|---|
PublishStore(java.lang.String path)
Creates a new PublishStore with the given path.
|
PublishStore(java.lang.String path,
int initialCapacity)
Creates a new PublishStore with the given path.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the memory mapped file.
|
protected void |
finalize()
Overridden to call close() upon garbage collection.
|
void |
sync()
Forces any in memory changes to be written to persistent storage.
|
void |
truncateOnClose(boolean truncate)
Tells the PublishStore to truncate the file to its original size if there are no saved Messages when it is closed.
|
discardUpTo, flush, flush, getErrorOnPublishGap, getHighestUnpersisted, getLastPersisted, getLowestUnpersisted, growFreeListIfEmpty, recover, replay, replaySingle, setErrorOnPublishGap, setMessage, setResizeHandler, store, store, unpersistedCountpublic PublishStore(java.lang.String path)
throws StoreException
path - The path (absolute or relative) of the publish storeStoreException - Thrown when an operation on the store fails.public PublishStore(java.lang.String path,
int initialCapacity)
throws StoreException
path - The path (absolute or relative) of the publish storeinitialCapacity - The initial capacity (in 2k blocks) of the store. This
size is also used when resizing the store: the store
is resized by this value each time the store grows. A
general guideline for initial capacity is to set the
capacity to messages_published_per_second *
int(average_message_size / block_size) +
1.StoreException - Thrown when an operation on the store fails.public void truncateOnClose(boolean truncate)
truncate - If true, file will be truncated when the PublishStore is
closed.public void close()
throws java.lang.Exception
close in interface java.lang.AutoCloseableclose in class BlockPublishStorejava.io.IOException - Thrown when an operation on the file produces an IOException.java.lang.Exception - If an error occurs during the closing operation.public void sync()
throws java.io.IOException
java.io.IOException - Thrown when an operation on the file produces an
IOException.protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable