com.crankuptheamps.client
Class PublishStore

java.lang.Object
  extended by com.crankuptheamps.client.BlockPublishStore
      extended by 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

Nested Class Summary
 
Nested classes/interfaces inherited from class com.crankuptheamps.client.BlockPublishStore
BlockPublishStore.Buffer, BlockPublishStore.ByteSequence
 
Nested classes/interfaces inherited from interface com.crankuptheamps.client.Store
Store.StoreReplayer
 
Field Summary
 
Fields inherited from class com.crankuptheamps.client.BlockPublishStore
_buffer, HAS_EXTENDED_METADATA
 
Fields inherited from interface com.crankuptheamps.client.Store
SOWDeleteByData, SOWDeleteByFilter, SOWDeleteByKeys
 
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.
 
Method Summary
 void close()
           
protected  void finalize()
           
 void sync()
           
 
Methods inherited from class com.crankuptheamps.client.BlockPublishStore
_store, discardUpTo, flush, flush, getLowestUnpersisted, growFreeListIfEmpty, recover, replay, replaySingle, setResizeHandler, store, store, store, unpersistedCount
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 store
initialCapacity - The initial capacity (in 2k blocks) of the store. This size is also used when resizing the store.
Throws:
IOException
StoreException
Method Detail

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