org.apache.servicemix.store.memory
Class TimeoutMemoryStore
java.lang.Object
org.apache.servicemix.store.memory.MemoryStore
org.apache.servicemix.store.memory.TimeoutMemoryStore
- All Implemented Interfaces:
- Store
public class TimeoutMemoryStore
- extends MemoryStore
MemoryStore
which removes entries from the store after the specified timeout
to free memory.
Method Summary |
java.lang.Object |
load(java.lang.String id)
Loads an object that has been previously stored under the specified key. |
void |
store(java.lang.String id,
java.lang.Object data)
Put an object in the store under the given id. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TimeoutMemoryStore
protected TimeoutMemoryStore(IdGenerator idGenerator,
long timeout)
store
public void store(java.lang.String id,
java.lang.Object data)
throws java.io.IOException
- Put an object in the store under the given id.
This method must be used with caution and the behavior is
unspecified if an object already exist for the same id.
- Specified by:
store
in interface Store
- Overrides:
store
in class MemoryStore
- Parameters:
id
- the id of the object to storedata
- the object to store
- Throws:
java.io.IOException
- if an error occurs
load
public java.lang.Object load(java.lang.String id)
throws java.io.IOException
- Loads an object that has been previously stored under the specified key.
The object is removed from the store.
Before attempting to load the object, all data older than the specified timeout will first be
removed from the store.
- Specified by:
load
in interface Store
- Overrides:
load
in class MemoryStore
- Parameters:
id
- the id of the object
- Returns:
- the object, or
null>
if the object could not be found
- Throws:
java.io.IOException
- if an error occurs
Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.