public abstract class BackingStore<K extends Serializable,V extends Serializable> extends Object
BackingStoreFactory.createBackingStore()
method.
The BackingStore instance is created and used for storing data that belongs
to a single application or container.
The store implementation must be thread safe.
Constructor and Description |
---|
BackingStore() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Typically called during shutdown of the process.
|
protected ObjectInputStream |
createObjectInputStream(InputStream is) |
protected ObjectOutputStream |
createObjectOutputStream(OutputStream os) |
void |
destroy()
Called when the store is no longer needed.
|
protected BackingStoreConfiguration<K,V> |
getBackingStoreConfiguration() |
abstract BackingStoreFactory |
getBackingStoreFactory() |
protected void |
initialize(BackingStoreConfiguration<K,V> conf) |
abstract V |
load(K key,
String version)
Load and return the data for the given id.
|
abstract void |
remove(K key)
Remove the association for the id.
|
int |
removeExpired()
Remove expired entries
|
int |
removeExpired(long idleForMillis) |
abstract String |
save(K key,
V value,
boolean isNew)
Save the value whose key is id.
|
abstract int |
size()
Get the current size of the store
|
void |
updateTimestamp(K key,
long time)
TODO: BEGIN: REMOVE after shoal integration
|
String |
updateTimestamp(K key,
String version,
Long accessTime)
Recomended way is to just do a save(k, v)
|
protected void initialize(BackingStoreConfiguration<K,V> conf) throws BackingStoreException
BackingStoreException
protected BackingStoreConfiguration<K,V> getBackingStoreConfiguration()
public abstract BackingStoreFactory getBackingStoreFactory()
public abstract V load(K key, String version) throws BackingStoreException
save()
method.key
- the key whose value must be returnedNullPointerException
- if the id is nullBackingStoreException
- if the underlying store implementation encounters any
exceptionpublic abstract String save(K key, V value, boolean isNew) throws BackingStoreException
key
- the idvalue
- The Metadata to be storedBackingStoreException
- if the underlying store implementation encounters any
exceptionpublic abstract void remove(K key) throws BackingStoreException
load(id)
must return
null. In addition, any association between id
and
container extra params must also be removed.key
- the id of the MetadataBackingStoreException
- if the underlying store implementation encounters any
exceptionpublic void updateTimestamp(K key, long time) throws BackingStoreException
BackingStoreException
public int removeExpired(long idleForMillis) throws BackingStoreException
BackingStoreException
public String updateTimestamp(K key, String version, Long accessTime) throws BackingStoreException
key
- version
- accessTime
- BackingStoreException
public int removeExpired() throws BackingStoreException
BackingStoreException
public abstract int size() throws BackingStoreException
BackingStoreException
- if the underlying store implementation encounters any
exceptionpublic void close() throws BackingStoreException
BackingStoreException
public void destroy() throws BackingStoreException
BackingStoreException
protected ObjectOutputStream createObjectOutputStream(OutputStream os) throws IOException
IOException
protected ObjectInputStream createObjectInputStream(InputStream is) throws IOException
IOException
Copyright © 2016 Oracle Corporation. All rights reserved.