|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.camel.processor.idempotent.FileIdempotentRepository
public class FileIdempotentRepository
A file based implementation of IdempotentRepository
.
Map
to avoid this class being a
memory leak.
Constructor Summary | |
---|---|
FileIdempotentRepository()
|
|
FileIdempotentRepository(File fileStore,
Map<String,Object> set)
|
Method Summary | |
---|---|
boolean |
add(String messageId)
Adds the key to the repository. |
protected void |
appendToStore(String messageId)
Appends the given message id to the file store |
boolean |
confirm(String key)
Confirms the key, after the exchange has been processed sucesfully. |
boolean |
contains(String key)
Returns true if this repository contains the specified element. |
static IdempotentRepository<String> |
fileIdempotentRepository(File fileStore)
Creates a new file based repository using a LRUCache
as 1st level cache with a default of 1000 entries in the cache. |
static IdempotentRepository<String> |
fileIdempotentRepository(File fileStore,
int cacheSize)
Creates a new file based repository using a LRUCache
as 1st level cache. |
static IdempotentRepository<String> |
fileIdempotentRepository(File fileStore,
int cacheSize,
long maxFileStoreSize)
Creates a new file based repository using a LRUCache
as 1st level cache. |
static IdempotentRepository<String> |
fileIdempotentRepository(File store,
Map<String,Object> cache)
Creates a new file based repository using the given Map
as 1st level cache. |
Map<String,Object> |
getCache()
|
File |
getFileStore()
|
long |
getMaxFileStoreSize()
|
protected void |
loadStore()
Loads the given file store into the 1st level cache |
boolean |
remove(String key)
Removes the key from the repository. |
void |
setCache(Map<String,Object> cache)
|
void |
setCacheSize(int size)
Sets the cache size |
void |
setFileStore(File fileStore)
|
void |
setMaxFileStoreSize(long maxFileStoreSize)
Sets the maximum filesize for the file store in bytes. |
protected void |
trunkStore()
Trunks the file store when the max store size is hit by rewriting the 1st level cache to the file store. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileIdempotentRepository()
public FileIdempotentRepository(File fileStore, Map<String,Object> set)
Method Detail |
---|
public static IdempotentRepository<String> fileIdempotentRepository(File fileStore)
LRUCache
as 1st level cache with a default of 1000 entries in the cache.
fileStore
- the file storepublic static IdempotentRepository<String> fileIdempotentRepository(File fileStore, int cacheSize)
LRUCache
as 1st level cache.
fileStore
- the file storecacheSize
- the cache sizepublic static IdempotentRepository<String> fileIdempotentRepository(File fileStore, int cacheSize, long maxFileStoreSize)
LRUCache
as 1st level cache.
fileStore
- the file storecacheSize
- the cache sizemaxFileStoreSize
- the max size in bytes for the filestore filepublic static IdempotentRepository<String> fileIdempotentRepository(File store, Map<String,Object> cache)
Map
as 1st level cache.
Care should be taken to use a suitable underlying Map
to avoid this class being a
memory leak.
store
- the file storecache
- the cache to use as 1st level cachepublic boolean add(String messageId)
IdempotentRepository
add
in interface IdempotentRepository<String>
messageId
- the key of the message for duplicate test
public boolean contains(String key)
IdempotentRepository
contains
in interface IdempotentRepository<String>
key
- the key of the message
public boolean remove(String key)
IdempotentRepository
remove
in interface IdempotentRepository<String>
key
- the key of the message for duplicate test
public boolean confirm(String key)
IdempotentRepository
confirm
in interface IdempotentRepository<String>
key
- the key of the message for duplicate test
public File getFileStore()
public void setFileStore(File fileStore)
public Map<String,Object> getCache()
public void setCache(Map<String,Object> cache)
public long getMaxFileStoreSize()
public void setMaxFileStoreSize(long maxFileStoreSize)
public void setCacheSize(int size)
protected void appendToStore(String messageId)
messageId
- the message idprotected void trunkStore()
protected void loadStore()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |