com.crankuptheamps.client
Class PublishStore
java.lang.Object
com.crankuptheamps.client.BlockPublishStore
com.crankuptheamps.client.PublishStore
- All Implemented Interfaces:
- Store
public class PublishStore
- extends BlockPublishStore
PublishStore is a memory-mapped file-backed store for storing outgoing messages.
As messages are stored, space is allocated from a pre-created flat buffer on disk.
As messages are discarded, space in that buffer is marked "free" for future store operations.
If messages are stored faster than they are published, the buffer is re-sized to create more capacity.
- Author:
- dnoor
Constructor Summary |
PublishStore(String path)
Creates a new PublishStore with the given path. |
PublishStore(String path,
int initialCapacity)
Creates a new PublishStore with the given path. |
Methods inherited from class com.crankuptheamps.client.BlockPublishStore |
_store, discardUpTo, flush, flush, getLowestUnpersisted, growFreeListIfEmpty, recover, replay, replaySingle, setResizeHandler, store, store, store, unpersistedCount |
PublishStore
public PublishStore(String path)
throws StoreException
- Creates a new PublishStore with the given path. Immediately proceeds to recovery if the file exists.
- Parameters:
path
- The path (absolute or relative) of the publish store
- Throws:
IOException
StoreException
PublishStore
public PublishStore(String path,
int initialCapacity)
throws StoreException
- Creates a new PublishStore with the given path. Immediately proceeds to recovery if the file exists.
- Parameters:
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.
- Throws:
IOException
StoreException
close
public void close()
throws IOException
- Throws:
IOException
sync
public void sync()
throws IOException
- Throws:
IOException
finalize
protected void finalize()
throws Throwable
- Overrides:
finalize
in class Object
- Throws:
Throwable