Package org.ehcache.spi.persistence
Interface PersistableResourceService
- All Superinterfaces:
MaintainableService,Service
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn identifier for an existing persistable resource.Nested classes/interfaces inherited from interface org.ehcache.spi.service.MaintainableService
MaintainableService.MaintenanceScope -
Method Summary
Modifier and TypeMethodDescriptionvoidDestroys the persistence space with the given name.voidDestroys all persistence spaces.getPersistenceSpaceIdentifier(String name, ResourcePool resource) Returns aPersistableResourceService.PersistenceSpaceIdentifierfor the space associated to the provided arguments.Returns aPersistableResourceService.PersistenceSpaceIdentifierfor a space shared across all caches.getStateRepositoryWithin(PersistableResourceService.PersistenceSpaceIdentifier<?> identifier, String name) Returns a namedstate repositoryin the context of the givenidentifier.booleanhandlesResourceType(ResourceType<?> resourceType) Returnstrueif this service handles the given resource type.voidreleasePersistenceSpaceIdentifier(PersistableResourceService.PersistenceSpaceIdentifier<?> identifier) Releases a previously obtainedPersistableResourceService.PersistenceSpaceIdentifier.Methods inherited from interface org.ehcache.spi.service.MaintainableService
startForMaintenance
-
Method Details
-
handlesResourceType
Returnstrueif this service handles the given resource type.- Parameters:
resourceType- the resource type to check- Returns:
trueif this service handles the resource type
-
getPersistenceSpaceIdentifier
PersistableResourceService.PersistenceSpaceIdentifier<?> getPersistenceSpaceIdentifier(String name, ResourcePool resource) throws CachePersistenceException Returns aPersistableResourceService.PersistenceSpaceIdentifierfor 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.
- Parameters:
name- the name of the persistence contextresource- the associated persistable resource pool- Returns:
- an identifier for the persistence space
- Throws:
CachePersistenceException- if the persistence space cannot be created- See Also:
-
releasePersistenceSpaceIdentifier
void releasePersistenceSpaceIdentifier(PersistableResourceService.PersistenceSpaceIdentifier<?> identifier) throws CachePersistenceException Releases a previously obtainedPersistableResourceService.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.
- Parameters:
identifier- thePersistenceSpaceIdentifierto release- Throws:
CachePersistenceException- If the identifier is not known
-
getStateRepositoryWithin
StateRepository getStateRepositoryWithin(PersistableResourceService.PersistenceSpaceIdentifier<?> identifier, String name) throws CachePersistenceException Returns a namedstate repositoryin the context of the givenidentifier.If the
StateRepositoryalready existed, this method returns it in a fully available state.- Parameters:
identifier- the space identifiername- the state repository name- Returns:
- a
StateRepository - Throws:
CachePersistenceException- if theStateRepositorycannot be created or recovered.
-
destroy
Destroys the persistence space with the given name.This method can be called without having created the persistence space from this JVM.
- Parameters:
name- persistence context name- Throws:
CachePersistenceException- if the persistence space cannot be destroyed
-
destroyAll
Destroys all persistence spaces.Note that this method can be called without having created the persistence spaces from this JVM.
- Throws:
CachePersistenceException- if the persistence storage cannot be destroyed
-