public interface PersistableResourceService extends MaintainableService
Modifier and Type | Interface and Description |
---|---|
static interface |
PersistableResourceService.PersistenceSpaceIdentifier<T extends PersistableResourceService>
An identifier for an existing persistable resource.
|
MaintainableService.MaintenanceScope
Modifier and Type | Method and Description |
---|---|
void |
destroy(java.lang.String name)
Destroys the persistence space with the given name.
|
void |
destroyAll()
Destroys all persistence spaces.
|
PersistableResourceService.PersistenceSpaceIdentifier<?> |
getPersistenceSpaceIdentifier(java.lang.String name,
CacheConfiguration<?,?> config)
Returns a
PersistableResourceService.PersistenceSpaceIdentifier for the space associated to the provided arguments. |
StateRepository |
getStateRepositoryWithin(PersistableResourceService.PersistenceSpaceIdentifier<?> identifier,
java.lang.String name)
Returns a named
state repository in the context of the given
identifier . |
boolean |
handlesResourceType(ResourceType<?> resourceType)
Returns
true if this service handles the given resource type. |
void |
releasePersistenceSpaceIdentifier(PersistableResourceService.PersistenceSpaceIdentifier<?> identifier)
Releases a previously obtained
PersistableResourceService.PersistenceSpaceIdentifier . |
startForMaintenance
boolean handlesResourceType(ResourceType<?> resourceType)
true
if this service handles the given resource type.resourceType
- the resource type to checktrue
if this service handles the resource typePersistableResourceService.PersistenceSpaceIdentifier<?> getPersistenceSpaceIdentifier(java.lang.String name, CacheConfiguration<?,?> config) throws CachePersistenceException
PersistableResourceService.PersistenceSpaceIdentifier
for the space associated to the provided arguments.
This method may create a new persistence space or load one. The returned identifier is the only way to interact with the persistence space.
name
- the name of the persistence contextconfig
- the configuration for the associated cacheCachePersistenceException
- if the persistence space cannot be createdgetStateRepositoryWithin(PersistenceSpaceIdentifier, String)
void releasePersistenceSpaceIdentifier(PersistableResourceService.PersistenceSpaceIdentifier<?> identifier) throws CachePersistenceException
PersistableResourceService.PersistenceSpaceIdentifier
.
This indicates to the persistence space that resource linked to the given identifier are no longer needed and thus enables cleaning up any transient state left.
identifier
- the PersistenceSpaceIdentifier
to releaseCachePersistenceException
- If the identifier is not knownStateRepository getStateRepositoryWithin(PersistableResourceService.PersistenceSpaceIdentifier<?> identifier, java.lang.String name) throws CachePersistenceException
state repository
in the context of the given
identifier
.
If the StateRepository
already existed, this method returns it in a fully available state.
identifier
- the space identifiername
- the state repository nameStateRepository
CachePersistenceException
- if the StateRepository
cannot be created or recovered.void destroy(java.lang.String name) throws CachePersistenceException
This method can be called without having created the persistence space from this JVM.
name
- persistence context nameCachePersistenceException
- if the persistence space cannot be destroyedvoid destroyAll() throws CachePersistenceException
Note that this method can be called without having created the persistence spaces from this JVM.
CachePersistenceException
- if the persistence storage cannot be destroyed