org.mule.routing.inbound
Class IdempotentInMemoryMessageIdStore

java.lang.Object
  extended by org.mule.routing.inbound.IdempotentInMemoryMessageIdStore
All Implemented Interfaces:
IdempotentMessageIdStore

public class IdempotentInMemoryMessageIdStore
extends Object
implements IdempotentMessageIdStore

IdempotentInMemoryMessageIdStore implements an optionally bounded in-memory store for message IDs with periodic expiry of old entries. The bounded size is a soft limit and only enforced periodically by the expiry process; this means that the store may temporarily exceed its maximum size between expiry runs, but will eventually shrink to its configured size.


Nested Class Summary
protected  class IdempotentInMemoryMessageIdStore.Expirer
           
 
Field Summary
protected  int entryTTL
           
protected  int expirationInterval
           
protected  Log logger
           
protected  int maxEntries
           
protected  ScheduledThreadPoolExecutor scheduler
           
protected  ConcurrentSkipListMap store
           
 
Constructor Summary
IdempotentInMemoryMessageIdStore(String name, int maxEntries, int entryTTL, int expirationInterval)
          Default constructor for IdempotentInMemoryMessageIdStore.
 
Method Summary
 boolean containsId(Object id)
          Check whether the given ID is already registered with this store.
protected  void expire()
           
 boolean storeId(Object id)
          Store the given ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final Log logger

store

protected final ConcurrentSkipListMap store

scheduler

protected final ScheduledThreadPoolExecutor scheduler

maxEntries

protected final int maxEntries

entryTTL

protected final int entryTTL

expirationInterval

protected final int expirationInterval
Constructor Detail

IdempotentInMemoryMessageIdStore

public IdempotentInMemoryMessageIdStore(String name,
                                        int maxEntries,
                                        int entryTTL,
                                        int expirationInterval)
Default constructor for IdempotentInMemoryMessageIdStore.

Parameters:
name - a name for this store, can be used for logging and identification purposes
maxEntries - the maximum number of entries that this store keeps around. Specify -1 if the store is supposed to be "unbounded".
entryTTL - the time-to-live for each message ID, specified in seconds, or -1 for entries that should never expire. DO NOT combine this with an unbounded store!
expirationInterval - the interval for periodic bounded size enforcement and entry expiration, specified in seconds. Arbitrary positive values between 1 second and several hours or days are possible, but should be chosen carefully according to the expected message rate to prevent OutOfMemory conditions.
Throws:
{@link - IllegalArgumentException} if non-positive values are specified for expirationInterval
See Also:
IdempotentReceiver.createMessageIdStore()
Method Detail

containsId

public boolean containsId(Object id)
                   throws IllegalArgumentException,
                          Exception
Description copied from interface: IdempotentMessageIdStore
Check whether the given ID is already registered with this store.

Specified by:
containsId in interface IdempotentMessageIdStore
Parameters:
id - the ID to check
Returns:
true if the ID is stored or false if it could not be found
Throws:
IllegalArgumentException - if the given ID is null
Exception - if any implementation-specific error occured, e.g. when the store is not available

storeId

public boolean storeId(Object id)
                throws IllegalArgumentException,
                       Exception
Description copied from interface: IdempotentMessageIdStore
Store the given ID.

Specified by:
storeId in interface IdempotentMessageIdStore
Parameters:
id - the ID to store
Returns:
true if the ID was stored properly, or false if it already existed
Throws:
IllegalArgumentException - if the given ID cannot be stored or is null
Exception - if the store is not available or any other implementation-specific error occured

expire

protected void expire()


Copyright © 2003-2008 MuleSource, Inc.. All Rights Reserved.