Gemfire JavaDocs
Package org.apache.geode.cache
Interface RegionService
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Subinterfaces:
Cache
,ClientCache
,GemFireCache
public interface RegionService extends java.lang.AutoCloseable
A RegionService provides access to existingregions
that exist in aGemFire cache
. Regions can be obtained usinggetRegion(java.lang.String)
and queried usinggetQueryService()
. The service should beclosed
to free up resources once it is no longer needed. Once itis closed
any attempt to use it or anyregions
obtained from it will cause aCacheClosedException
to be thrown.Instances of the interface are created using one of the following methods:
CacheFactory.create()
creates a server instance ofCache
.ClientCacheFactory.create()
creates a client instance ofClientCache
.ClientCache.createAuthenticatedView(Properties)
creates a client multiuser authenticated cache view.
- Since:
- GemFire 6.5
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
close()
Terminates this region service and releases all its resources.PdxInstance
createPdxEnum(java.lang.String className, java.lang.String enumName, int enumOrdinal)
Creates and returns a PdxInstance that represents an enum value.PdxInstanceFactory
createPdxInstanceFactory(java.lang.String className)
Returns a factory that can create aPdxInstance
.CancelCriterion
getCancelCriterion()
the cancellation criterion for this serviceJsonDocumentFactory
getJsonDocumentFactory()
Returns the JsonDocumentFactory with the default storage formatStorageFormat.BSON
.JsonDocumentFactory
getJsonDocumentFactory(StorageFormat storageFormat)
Returns the JsonDocumentFactory with the specifiedStorageFormat
.JSONFormatter
getJsonFormatter()
Deprecated.since GemFire 10.0, please use thegetJsonDocumentFactory(StorageFormat)
instead.QueryService
getQueryService()
Return the QueryService for this region service.<K,V>
Region<K,V>getRegion(java.lang.String path)
Return the existing region (or subregion) with the specified path.boolean
isClosed()
Indicates if this region service has been closed.java.util.Set<Region<?,?>>
rootRegions()
Returns unmodifiable set of the root regions that are in the region service.
-
-
-
Method Detail
-
getCancelCriterion
CancelCriterion getCancelCriterion()
the cancellation criterion for this service- Returns:
- the service's cancellation object
-
getRegion
<K,V> Region<K,V> getRegion(java.lang.String path)
Return the existing region (or subregion) with the specified path. Whether or not the path starts with a forward slash it is interpreted as a full path starting at a root.- Type Parameters:
K
- the type of keys in the regionV
- the type of values in the region- Parameters:
path
- the path to the region- Returns:
- the Region or null if not found
- Throws:
java.lang.IllegalArgumentException
- if path is null, the empty string, or "/"
-
rootRegions
java.util.Set<Region<?,?>> rootRegions()
Returns unmodifiable set of the root regions that are in the region service. This set is a snapshot; it is not backed by the region service.- Returns:
- a Set of regions
-
createPdxInstanceFactory
PdxInstanceFactory createPdxInstanceFactory(java.lang.String className)
Returns a factory that can create aPdxInstance
.- Parameters:
className
- the fully qualified class name that the PdxInstance will become when it is fully deserialized unlessPdxInstanceFactory.neverDeserialize()
is called. If className is the empty string then no class versioning will be done for that PdxInstance andPdxInstanceFactory.neverDeserialize()
will be automatically called on the returned factory.- Returns:
- the factory
- Throws:
java.lang.IllegalArgumentException
- if className isnull
.- Since:
- GemFire 6.6.2
-
createPdxEnum
PdxInstance createPdxEnum(java.lang.String className, java.lang.String enumName, int enumOrdinal)
Creates and returns a PdxInstance that represents an enum value.- Parameters:
className
- the name of the enum classenumName
- the name of the enum constantenumOrdinal
- the ordinal value of the enum constant- Returns:
- a PdxInstance that represents the enum value
- Throws:
java.lang.IllegalArgumentException
- if className or enumName arenull
.- Since:
- GemFire 6.6.2
-
getQueryService
QueryService getQueryService()
Return the QueryService for this region service. For a region service in a client the returned QueryService will execute queries on the server. For a region service not in a client the returned QueryService will execute queries on the local and peer regions.- Returns:
- the QueryService for this region service
-
getJsonFormatter
@Deprecated JSONFormatter getJsonFormatter()
Deprecated.since GemFire 10.0, please use thegetJsonDocumentFactory(StorageFormat)
instead.Returns the JSONFormatter. In the multi-user case, this will return a JSONFormatter that has the knowledge of the user associated with this region service.- Returns:
- the JSONFormatter
-
getJsonDocumentFactory
JsonDocumentFactory getJsonDocumentFactory()
Returns the JsonDocumentFactory with the default storage formatStorageFormat.BSON
.- Returns:
- the default JsonDocumentFactory.
-
getJsonDocumentFactory
JsonDocumentFactory getJsonDocumentFactory(StorageFormat storageFormat)
Returns the JsonDocumentFactory with the specifiedStorageFormat
.- Parameters:
storageFormat
- the storage format the JsonDocumentFactory will use.- Returns:
- the JsonDocumentFactory with the specified storage format.
-
close
void close()
Terminates this region service and releases all its resources. CallsRegion.close()
on each region in the service. After this service is closed, any further method calls on this service or any region object obtained from the service will throwCacheClosedException
, unless otherwise noted.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
CacheClosedException
- if the service is already closed.
-
isClosed
boolean isClosed()
Indicates if this region service has been closed. After a new service is created, this method returns false; After close is called on this service, this method returns true. This method does not throwCacheClosedException
if the service is closed.- Returns:
- true, if this service has just been created or has started to close; false, otherwise
-
-