public class InlineItemCache extends java.lang.Object implements ProcessedItemCache
In the adapter configuration file this class is aliased as fs-inline-processed-item-cache which is the preferred alternative to the fully qualified classname when building your configuration.
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,ProcessedItem> |
cache |
protected org.slf4j.Logger |
logR |
Constructor and Description |
---|
InlineItemCache() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the cache.
|
void |
close()
Closes the component.
|
boolean |
contains(java.lang.String key)
Query the cache for this key.
|
void |
evict()
evict any items in the cache that require it..
|
ProcessedItem |
get(java.lang.String key)
Get the TrackedItem associated with the key.
|
TimeInterval |
getAgeBeforeEviction() |
void |
init()
Initialises the component.
|
void |
save()
Explicitly save the state of the cache.
|
void |
setAgeBeforeEviction(TimeInterval interval)
Specify the age of an entry in the cache before it is evicted.
|
int |
size()
Return the number of items in the cache.
|
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
void |
update(ProcessedItem i)
Update the cache with the tracked item.
|
void |
update(ProcessedItemList list)
Update the cache with the associated list of entries.
|
protected transient java.util.Map<java.lang.String,ProcessedItem> cache
protected transient org.slf4j.Logger logR
public boolean contains(java.lang.String key)
ProcessedItemCache
contains
in interface ProcessedItemCache
key
- the keypublic ProcessedItem get(java.lang.String key)
ProcessedItemCache
get
in interface ProcessedItemCache
key
- the keypublic void update(ProcessedItem i)
ProcessedItemCache
update
in interface ProcessedItemCache
i
- the tracked item.public void clear()
ProcessedItemCache
clear
in interface ProcessedItemCache
public int size()
ProcessedItemCache
size
in interface ProcessedItemCache
public void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException
may
cause unintended consequences
close
in interface ComponentLifecycle
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
init
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
spublic void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
start
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
spublic void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
stop
in interface ComponentLifecycle
public void save()
ProcessedItemCache
save
in interface ProcessedItemCache
public void evict()
ProcessedItemCache
evict
in interface ProcessedItemCache
public void update(ProcessedItemList list)
ProcessedItemCache
update
in interface ProcessedItemCache
list
- a list of tracked itemspublic TimeInterval getAgeBeforeEviction()
public void setAgeBeforeEviction(TimeInterval interval)
interval
- the time before eviction to set, default 12 hours