|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
K - the key type processed by this loader-writerV - the value type processed by this loader-writer
//These are already linkedpublic interface CacheLoaderWriter<K,V>
A CacheLoaderWriter is used to keep a Cache in sync with another system.
Instances of this class should be thread safe.
Any Exception thrown by the loading methods of this interface will be wrapped into a
CacheLoadingException by the Cache and will need to be handled by
the user. Any java.lang.Exception thrown by the writing methods will
be wrapped into a CacheWritingException.
WTF? A similar thing will happen for the bulk version of the loading and writing methods and create the bulk version of the related exceptions.
CacheLoadingException,
CacheWritingException,
BulkCacheLoadingException,
BulkCacheWritingException| Method Summary | |
|---|---|
void |
delete(K key)
Deletes a single mapping. |
void |
deleteAll(java.lang.Iterable<? extends K> keys)
Deletes multiple mappings. |
V |
load(K key)
Loads a single value. |
java.util.Map<K,V> |
loadAll(java.lang.Iterable<? extends K> keys)
Loads multiple values. |
void |
write(K key,
V value)
Writes a single mapping. |
void |
writeAll(java.lang.Iterable<? extends java.util.Map.Entry<? extends K,? extends V>> entries)
Writes multiple mappings. |
| Method Detail |
|---|
V load(K key)
throws java.lang.Exception
When used with a cache any exception thrown by this method will be thrown
back to the user as a CacheLoadingException.
key - the key for which to load the value
java.lang.Exception - if the value cannot be loaded
java.util.Map<K,V> loadAll(java.lang.Iterable<? extends K> keys)
throws BulkCacheLoadingException,
java.lang.Exception
The returned Map should contain null values for the keys
that could not be found.
When used with a cache the mappings that will be installed are the keys as found in keys
mapped to the results of loadAllResult.get(key). Any other mappings will be ignored.
By using a BulkCacheLoadingException implementors can report partial success. Any other exceptions will
be thrown back to the Cache user through a BulkCacheLoadingException indicating a complete failure.
keys - the keys to load
//Which null or not present?
Map of values for each key passed in, where no mapping means no value to map.
BulkCacheLoadingException - in case of partial success
java.lang.Exception - in case no values could be loaded
void write(K key,
V value)
throws java.lang.Exception
The write may represent a brand new value or an update to an existing value.
When used with a Cache any exception thrown by this method will
be thrown back to the user through a CacheWritingException.
key - the key to writevalue - the value to write
java.lang.Exception - if the write operation failed
void writeAll(java.lang.Iterable<? extends java.util.Map.Entry<? extends K,? extends V>> entries)
throws BulkCacheWritingException,
java.lang.Exception
The writes may represent a mix of brand new values and updates to existing values.
By using a BulkCacheWritingException implementors can report partial success. Any other exception will
be thrown back to the Cache user through a BulkCacheWritingException indicating a complete failure.
entries - the mappings to write
BulkCacheWritingException - in case of partial success
java.lang.Exception - in case no values could be written
void delete(K key)
throws java.lang.Exception
key - the key to delete
java.lang.Exception - if the write operation failed
void deleteAll(java.lang.Iterable<? extends K> keys)
throws BulkCacheWritingException,
java.lang.Exception
By using a BulkCacheWritingException implementors can report partial success. Any other exception will
be thrown back to the Cache user through a BulkCacheWritingException indicating all deletes failed.
keys - the keys to delete
BulkCacheWritingException - in case of partial success
java.lang.Exception - in case no values can be loaded
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||