|
IBM WebSphereTM eXtreme Scale, Release 8.6 API Specification |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ObjectGridManager
ObjectGridManager is responsible for creating or retrieving local ObjectGrid instances and
connecting to distributed ObjectGrid servers. Use the ObjectGridManagerFactory
to
retrieve an ObjectGridManager.
Use the createObjectGrid
methods to create a local, in-memory
ObjectGrid instance. The createObjectGrid
methods give you the choice of caching the created ObjectGrid instance.
If you choose to cache the instance, you cannot create an ObjectGrid with the same name unless you remove the
previously created ObjectGrid using the removeObjectGrid(String)
method. A cached
ObjectGrid
instance can later be retrieved using the getObjectGrid(String)
method.
An example of creating a local in-memory ObjectGrid programmatically:
ObjectGridManager ogMgr = ObjectGridManagerFactory.getObjectGridManager(); ObjectGrid grid = ogMgr.createObjectGrid("LocalBookStoreGrid"); grid.defineMap("Orders"); grid.defineMap("Books"); grid.initialize(); ... grid.destroy();An example of creating a local in-memory ObjectGrid using an ObjectGrid descriptor XML file:
ObjectGridManager ogMgr = ObjectGridManagerFactory.getObjectGridManager(); URL objectgridXML = Thread.currentThread().getContextClassLoader().getResource("configs/objectgrid.xml"); ObjectGrid grid = ogMgr.createObjectGrid("LocalBookStoreGrid", objectgridXML); grid.initialize(); ... ogMgr.destroy();Use the
connect
methods to connect to a distributed ObjectGrid. The connect methods
return a ClientClusterContext that can then be passed to one of the getObjectGrid
methods, which
will in turn retrieve a client ObjectGrid instance.An example to connect to a dynamic, distributed ObjectGrid using a catalog server cluster:
ObjectGridManager ogMgr = ObjectGridManagerFactory.getObjectGridManager(); ClientClusterContext ccc = ogMgr.connect("catserver1:2809,catserver2:2809", null, null); ObjectGrid grid = ogMgr.getObjectGrid(ccc, "BookStoreGrid"); ... ogMgr.disconnect(ccc);An example to connect to an embedded ObjectGrid server (a server running in the current process):
ObjectGridManager ogMgr = ObjectGridManagerFactory.getObjectGridManager(); ClientClusterContext ccc = ogMgr.connect((ClientSecurityConfiguration) null, (URL) null); ObjectGrid grid = ogMgr.getObjectGrid(ccc, "BookStoreGrid"); ... ogMgr.disconnect(ccc);This interface also allows ObjectGrid trace to be disabled completely for performance improvements especially on a processor with a smaller L2 cache.
Method Summary | |
---|---|
ClientClusterContext |
connect(ClientSecurityConfiguration securityProps,
URL overRideObjectGridXml)
Use this method to connect to an embedded ObjectGrid server. |
ClientClusterContext |
connect(String catalogServerEndpoints,
ClientSecurityConfiguration securityProps,
URL overRideObjectGridXml)
Connects a client process to a remote ObjectGrid catalog server or catalog server cluster (a dynamic ObjectGrid deployment topology). |
ObjectGrid |
createObjectGrid()
Creates a local, in-memory instance of an ObjectGrid . |
ObjectGrid |
createObjectGrid(String objectGridName)
Creates and caches a local, in-memory ObjectGrid instance with the specified name. |
ObjectGrid |
createObjectGrid(String objectGridName,
boolean cacheInstance)
Creates a local, in-memory instance of an ObjectGrid with the specified name. |
ObjectGrid |
createObjectGrid(String objectGridName,
URL xmlFile)
Creates a local, in-memory ObjectGrid instance based on the specified ObjectGrid name and the ObjectGrid XML configuration file. |
ObjectGrid |
createObjectGrid(String objectGridName,
URL xmlFile,
boolean cacheInstance)
Creates a local, in-memory ObjectGrid instance based on the specified ObjectGrid name and the ObjectGrid XML configuration file. |
ObjectGrid |
createObjectGrid(String objectGridName,
URL xmlFile,
boolean enableXmlValidation,
boolean cacheInstance)
Deprecated. Deprecated in version 8.6. XML validation is always enabled. Use instead. |
List |
createObjectGrids(URL xmlFile)
Creates a List of a local, in-memory ObjectGrid instances
based upon the ObjectGrid configurations in the specified ObjectGrid descriptor XML file. |
List |
createObjectGrids(URL xmlFile,
boolean cacheInstances)
Creates a List of a local, in-memory ObjectGrid instances
based upon the ObjectGrid configurations in the specified ObjectGrid descriptor XML file. |
List |
createObjectGrids(URL xmlFile,
boolean enableXmlValidation,
boolean cacheInstances)
Deprecated. Deprecated in version 8.6. XML validation is always enabled. Use createObjectGrids(URL, boolean) instead. |
boolean |
disconnect(ClientClusterContext context)
Disconnects a client process from an ObjectGrid server |
CatalogDomainManager |
getCatalogDomainManager()
Retrieve the CatalogDomainManager for this ObjectGridManager. |
ObjectGrid |
getObjectGrid(ClientClusterContext context,
String objectGridName)
Returns a client ObjectGrid instance corresponding to an ObjectGrid in an
ObjectGrid cluster. |
ObjectGrid |
getObjectGrid(ClientClusterContext context,
String objectGridName,
ObjectGridConfiguration overrideOGConfig)
Returns a client ObjectGrid instance corresponding to an ObjectGrid in an
ObjectGrid cluster. |
ObjectGrid |
getObjectGrid(String objectGridName)
Returns a cached local, in-memory ObjectGrid instance by name. |
List |
getObjectGrids()
Gets a List of the local, in-memory ObjectGrid instances that have been previously cached. |
Map |
getOverrideObjectGridConfigurations()
Deprecated. This method is replaced in 7.1.1 with the getObjectGrid method that takes a ObjectGridConfigurations. |
String |
getTraceSpecification()
Retrieves the trace specification for the current JVM. |
void |
putOverrideObjectGridConfigurations(String clusterName,
List objectGridConfigList)
Deprecated. This method is replaced in 7.1.1 with the getObjectGrid method that takes a ObjectGridConfigurations. |
void |
removeObjectGrid(String objectGridName)
Removes a local, in-memory ObjectGrid from the cache of ObjectGrid instances. |
void |
removeObjectGrid(String objectGridName,
boolean destroy)
Removes a local, in-memory ObjectGrid from the cache of ObjectGrid instances and optionally destroys its associated resources. |
void |
setOverrideObjectGridConfigurations(Map overrideMap)
Deprecated. This method is replaced in 7.1.1 with the getObjectGrid method that takes a ObjectGridConfigurations. |
void |
setTraceEnabled(boolean enabledFlag)
Enables or disables ObjectGrid trace for the JVM. |
void |
setTraceFileName(String traceFileName)
Sets the trace output to go to a file instead of System.out . |
void |
setTraceSpecification(String traceSpec)
Set the trace specification for the current JVM. |
Method Detail |
---|
ObjectGrid createObjectGrid() throws ObjectGridException
ObjectGrid
.
The created ObjectGrid returned by this method is assigned a unique name is not cached by the
ObjectGridManager. Use the ObjectGrid.setName(String)
method to change the ObjectGrid name.
ObjectGridException
- if any error occurs during the ObjectGrid creationObjectGrid
,
ObjectGrid.setName(String)
ObjectGrid createObjectGrid(String objectGridName, boolean cacheInstance) throws ObjectGridException
The instance of ObjectGrid created can optionally be cached. If an ObjectGrid with the specified name was previously created and cached, an ObjectGridException will be thrown.
objectGridName
- the name of the ObjectGrid to be created. Must not be null
.cacheInstance
- true, if the ObjectGrid instance should be cached
IllegalArgumentException
- if objectGridName is null
ObjectGridException
- if an ObjectGrid with this name has already been cached or any error occurs during the ObjectGrid
creation.ObjectGrid
ObjectGrid createObjectGrid(String objectGridName) throws ObjectGridException
The ObjectGrid instance created by this method will be cached. Invoking this method is equivalent to invoke
createObjectGrid(String, true)
objectGridName
- the Name of the ObjectGrid instance to be created. Must not be null
.
IllegalArgumentException
- if objectGridName is null
ObjectGridException
- if an ObjectGrid with this name has already been cached, or any error occurs during the ObjectGrid
creationcreateObjectGrid(String, boolean)
,
ObjectGrid
@Deprecated ObjectGrid createObjectGrid(String objectGridName, URL xmlFile, boolean enableXmlValidation, boolean cacheInstance) throws ObjectGridException
instead.
An ObjectGrid instance is created for the ObjectGrid configuration in the XML file corresponding to the specified ObjectGrid name. If the specified ObjectGrid name cannot be found in the XML file, an exception will be thrown.
This returned ObjectGrid instance optionally can be cached.
If the URL is null, it will be simply ignored. In this case, this method behaves the same as the
createObjectGrid(String, boolean)
.
objectGridName
- the Name of the ObjectGrid instance to be returned. Must not be null
.xmlFile
- a URL to a well formed xml file based on the ObjectGrid schema.enableXmlValidation
- if true the XML is validatedcacheInstance
- a boolean value indicating whether the returned ObjectGrid instance defined in the XML will be cached
or not. If true, the instance will be cached.
IllegalArgumentException
- if objectGridName is null
ObjectGridException
- if an ObjectGrid with the same name has been previously cached, an ObjectGrid configuration with the
specified name can be found in the xml file, or any other error occurs during ObjectGrid creation.createObjectGrid(String, boolean)
,
ObjectGrid
ObjectGrid createObjectGrid(String objectGridName, URL xmlFile, boolean cacheInstance) throws ObjectGridException
An ObjectGrid instance is created for the ObjectGrid configuration in the XML file corresponding to the specified ObjectGrid name. If the specified ObjectGrid name cannot be found in the XML file, an exception will be thrown.
This returned ObjectGrid instance optionally can be cached.
If the URL is null, it will be simply ignored. In this case, this method behaves the same as the
createObjectGrid(String, boolean)
.
objectGridName
- the Name of the ObjectGrid instance to be returned. Must not be null
.xmlFile
- a URL to a well formed xml file based on the ObjectGrid schema.cacheInstance
- a boolean value indicating whether the returned ObjectGrid instance defined in the XML will be cached
or not. If true, the instance will be cached.
IllegalArgumentException
- if objectGridName is null
ObjectGridException
- if an ObjectGrid with the same name has been previously cached, an ObjectGrid configuration with the
specified name can be found in the xml file, or any other error occurs during ObjectGrid creation.createObjectGrid(String, boolean)
,
ObjectGrid
List createObjectGrids(URL xmlFile, boolean enableXmlValidation, boolean cacheInstances) throws ObjectGridException
createObjectGrids(URL, boolean)
instead.
List
of a local, in-memory ObjectGrid
instances
based upon the ObjectGrid configurations in the specified ObjectGrid descriptor XML file. The returned ObjecGrid instances can be cached. An ObjectGridException will be thrown when attempting to cache a newly created ObjectGrid that has the same name as an ObjectGrid that has already been cached.
xmlFile
- the file that defines an ObjectGrid or multiple ObjectGridscacheInstances
- set to true to cache all ObjectGrid instances created based on the file
ObjectGridException
- if attempting to create and cache an ObjectGrid with the same name as an ObjectGrid that has already
been cached, or any other error occurs during ObjectGrid creationObjectGrid
List createObjectGrids(URL xmlFile, boolean cacheInstances) throws ObjectGridException
List
of a local, in-memory ObjectGrid
instances
based upon the ObjectGrid configurations in the specified ObjectGrid descriptor XML file. The returned ObjecGrid instances can be cached. An ObjectGridException will be thrown when attempting to cache a newly created ObjectGrid that has the same name as an ObjectGrid that has already been cached.
xmlFile
- the file that defines an ObjectGrid or multiple ObjectGridscacheInstances
- set to true to cache all ObjectGrid instances created based on the file
ObjectGridException
- if attempting to create and cache an ObjectGrid with the same name as an ObjectGrid that has already
been cached, or any other error occurs during ObjectGrid creationObjectGrid
List createObjectGrids(URL xmlFile) throws ObjectGridException
List
of a local, in-memory ObjectGrid
instances
based upon the ObjectGrid configurations in the specified ObjectGrid descriptor XML file.
The XML file will be validated against the schema and each ObjectGrid instance that is created will be cached. An
ObjectGridException will be thrown when attempting to cache a newly created ObjectGrid that has the same name as
an ObjectGrid that has already been cached. Using this method is equivalent to calling the
createObjectGrids(URL, true, true)
method.
xmlFile
- The XML file to process. ObjectGrid(s) will be created based on the configurations what is in the
file.
ObjectGridException
- if attempting to create and cache an ObjectGrid with the same name as an ObjectGrid that has already
been cached, or any other error occurs during ObjectGrid creationcreateObjectGrids(URL, boolean, boolean)
,
ObjectGrid
ObjectGrid createObjectGrid(String objectGridName, URL xmlFile) throws ObjectGridException
If there is no ObjectGrid with this name defined in the XML file, an ObjectGridException will be thrown. The XML
file will be validated against the schema and the ObjectGrid instance created will be cached. Using this method
is equivalent to calling the createObjectGrid(String, URL, true, true)
method.
objectGridName
- name of the ObjectGrid to create. This ObjectGrid should be defined in the XML file. Must not be
null
.xmlFile
- the XML file to process
IllegalArgumentException
- if objectGridName is null
ObjectGridException
- if an ObjectGrid with the same name has been previously cached, an ObjectGrid configuration with the
specified name can be found in the xml file, or any other error occurs during ObjectGrid creation.createObjectGrid(String, URL, boolean, boolean)
,
ObjectGrid
void removeObjectGrid(String objectGridName) throws ObjectGridException
Invoking this method is equivalent to calling removeObjectGrid(String, false)
objectGridName
- the name of the ObjectGrid instance to remove from the cache
ObjectGridException
- if an ObjectGrid with the objectGridName was not found in the cacheremoveObjectGrid(String, boolean)
void removeObjectGrid(String objectGridName, boolean destroy) throws ObjectGridException
objectGridName
- the name of the ObjectGrid instance to remove from the cachedestroy
- if true, destroy the objectgrid instance and its associated resources
ObjectGridException
- if an ObjectGrid with the objectGridName was not found in the cacheObjectGrid.destroy()
List getObjectGrids()
List
of the local, in-memory ObjectGrid
instances that have been previously cached.
This method returns null
if no ObjectGrid instances have been cached.
null
if there are no
cached ObjectGrid instancesObjectGrid getObjectGrid(String objectGridName)
ObjectGrid
instance by name.
This method returns null
if no ObjectGrid
with the specified name is currently
cached.
objectGridName
- the cached objectgrid name.
void setTraceSpecification(String traceSpec)
This operation is a replace operation, not an append operation. The specification should be of the form:
TraceString := <ComponentString>(:<ComponentString>)* ComponentString := <ComponentName>=<type>=<state>(,<type>=<state>)* ComponentName := a java String state := [enabled|disabled] type := [all|debug|event|entryExit]
For example, ObjectGrid=all=enabled
traceSpec
- the new trace specificationString getTraceSpecification()
setTraceSpecification(String)
void setTraceFileName(String traceFileName)
System.out
.
The supplied file name can be relative to the working directory or a fully-qualified file name.
traceFileName
- Name of trace filevoid setTraceEnabled(boolean enabledFlag)
Disabling trace improves the performance when ObjectGrid runs on processors whose L2 caches are not large enough
to contain the trace enabled code paths. If this is set to false, ObjectGrid trace is suppressed even if it is
enabled using setTraceSpecification(String)
. By default ObjectGrid trace is enabled.
enabledFlag
- true to enable tracesetTraceSpecification(String)
ClientClusterContext connect(ClientSecurityConfiguration securityProps, URL overRideObjectGridXml) throws ConnectException
This method can be used to connect to both dynamic and static ObjectGrid server deployments.
securityProps
- client security configuration. The value can be null
if not running in secure mode.overRideObjectGridXml
- This parameter can be null
. If it is not null
, the client side
configuration of the ObjectGrid plugins are overridden with the ObjectGrid configuration using this
URL
. If this parameter is null
, client side ObjectGrid plugins can be
overridden by providing an overrideMap to setOverrideObjectGridConfigurations(Map)
or
by calling putOverrideObjectGridConfigurations(String, List)
.
In cases where this parameter is not null, and overriding configuration objects have been provided to
the ObjectGridManager by setOverrideObjectGridConfigurations(Map)
or
putOverrideObjectGridConfigurations(String, List)
, the configuration based on the XML
file will be used to override ObjectGrid settings. Overriding objects provided to
setOverrideObjectGridConfigurations(Map)
or
putOverrideObjectGridConfigurations(String, List)
will be ignored.
Not all plugins can be overridden. For details please see the ObjectGrid documentation.
ConnectException
- if any error occurs connecting to the serverClientClusterContext
,
ClientSecurityConfiguration
ClientClusterContext connect(String catalogServerEndpoints, ClientSecurityConfiguration securityProps, URL overRideObjectGridXml) throws ConnectException
catalogServerEndpoints
- A concatenated list of host/port pairs belonging to the catalog servers in the form "host:port<,host:port>".
This list can be arbitrarily long and is used for bootstrapping only. The first viable address will be
used.securityProps
- This parameter may be null if the client does not wish to establish a secure connection with the
server.overRideObjectGridXml
- This parameter can be null
. If it is not null
, the client side
configuration of the ObjectGrid plugins are overridden with the ObjectGrid configuration using this
URL
. If this parameter is null
, client side ObjectGrid plugins can be
overridden by providing an overrideMap to setOverrideObjectGridConfigurations(Map)
or by
calling putOverrideObjectGridConfigurations(String, List)
.
In cases where this parameter is not null, and overriding configuration objects have been provided to
the ObjectGridManager by setOverrideObjectGridConfigurations(Map)
or
putOverrideObjectGridConfigurations(String, List)
, the configuration based on the XML
file will be used to override ObjectGrid settings. Overriding objects provided to
setOverrideObjectGridConfigurations(Map)
or
putOverrideObjectGridConfigurations(String, List)
will be ignored.
Not all plugins can be overridden. For details please see the ObjectGrid documentation.
ConnectException
- If there is a problem connecting to the addresses given.boolean disconnect(ClientClusterContext context)
context
- the ClientClusterContext
object returned from a previous call to one of the
connect
methods The caller must guarantee this parameter is not null
.
true
if the disconnect was successful, false
if the supplied context was
not connected
IllegalArgumentException
- if the ClientClusterContext is nullClientClusterContext
ObjectGrid getObjectGrid(ClientClusterContext context, String objectGridName)
ObjectGrid
instance corresponding to an ObjectGrid
in an
ObjectGrid cluster.
This method is equivalent to calling getObjectGrid(context, objectGridName, null)
context
- the ClientClusterContext
object returned from a previous call to one of the
connect
methods The caller must guarantee this parameter is not null
.objectGridName
- the name of the requested client ObjectGrid
IllegalArgumentException
- if either provided parameter is null
ObjectGridRuntimeException
- is the ObjectGrid
with the specified name is not hosted in
any eXtreme Scale servers managed by the catalog serverClientClusterContext
,
ObjectGrid
,
getObjectGrid(ClientClusterContext, String, ObjectGridConfiguration)
ObjectGrid getObjectGrid(ClientClusterContext context, String objectGridName, ObjectGridConfiguration overrideOGConfig)
ObjectGrid
instance corresponding to an ObjectGrid
in an
ObjectGrid cluster.
This method replaces the get/set/putOverrideObjectGridConfigurations methods. Those methods had thread safety
issues. In addition they were global in nature so we end up having configuration override happen for all client
connections unless it was managed correctly. If ClientClusterContext was used previously to get an ObjectGrid for
the given name, the same ObjectGrid instance is returned even if the overrideOGConfig
parameter is
different.
context
- the ClientClusterContext
object returned from a previous call to one of the
connect
methods The caller must guarantee this parameter is not null
.objectGridName
- the name of the requested client ObjectGridoverrideOGConfig
- This parameter can be null
. If it is not null
, the client side
configuration of the ObjectGrid plugins are overridden with the ObjectGridConfiguration
provided. The provided override configuration takes precedence over any other provided override
configuration for the requested ObjectGrid name provided by the connect
,
putOverrideObjectGridConfigurations
, and
putOverrideObjectGridConfigurations
methods.
Not all plugins can be overridden. For details please see the ObjectGrid documentation.
ObjectGridConfiguration
,
ObjectGridConfigFactory
void setOverrideObjectGridConfigurations(Map overrideMap)
List
of ObjectGridConfiguration
objects to be
overridden.
Client side configuration of ObjectGrid and BackingMap plugins are overridden using the ObjectGridConfiguration
values provided in the List. To override a Plugin, each ObjectGridConfiguration
object must have a
name that matches the name of the ObjectGrid to be overridden. BackingMapConfiguration
objects
must have the same name as a BackingMap and be associated with the properObjectGridConfiguration
.
Not all plugins can be overridden. ObjectGrid plugins that can be overridden on the client side are TransactionCallback and ObjectGridEventListener. BackingMap plugins that can be overridden on the client side are Evictor and MapEventListener. Settings for the builtin Evictor can also be altered on the BackingMap. These settings include numberOfBuckets, timeToLive, and ttlEvictorType.
overrideMap
- a Map that will be used to override ObjectGrid settings on the client side. To override client side
settings, each key of the Map must be a String with a value that corresponds to a cluster name or domain name. Each
value of the overrideMap must be a java.util.List
. The List elements must be
ObjectGridConfiguration
objects. Each call to a connect method with a clusterName that
matches a key in the overrideMap will result in the client side settings being overridden using the
List of ObjectGridConfiguration objects provided in the key's corresponding value. Pass in
null
to clear an overrideMap that was previously set and thereby remove any overriding
settings from future connect calls.
IllegalArgumentException
- if any keys or values are null or if keys or values are of the wrong typeconnect(String, ClientSecurityConfiguration, URL)
,
connect(ClientSecurityConfiguration, URL)
,
ObjectGridConfiguration
,
BackingMapConfiguration
,
getObjectGrid(ClientClusterContext, String, ObjectGridConfiguration)
void putOverrideObjectGridConfigurations(String clusterName, List objectGridConfigList)
clusterName
- to be used as a key in the Map used to override client side ObjectGrid plugins. If a connect method is
called with a matching clusterName, the client side ObjectGrid and BackingMap plugins can be
overridden using the objectGridConfigList.
In the dynamic environment, use the domain name to override ObjectGrid settings.objectGridConfigList
- a List of ObjectGridConfiguration
objects that will be used to override client side
ObjectGrid settings if a connect method is called with a cluster name that matches the clusterName on
this method
IllegalArgumentException
- if the clusterName or objectGridConfigList is nullgetObjectGrid(ClientClusterContext, String, ObjectGridConfiguration)
Map getOverrideObjectGridConfigurations()
setOverrideObjectGridConfigurations
. The Map may also
have entries that were put there using the putOverrideObjectGridConfigurations
method.getObjectGrid(ClientClusterContext, String, ObjectGridConfiguration)
CatalogDomainManager getCatalogDomainManager()
|
IBM WebSphereTM eXtreme Scale, Release 8.6 API Specification |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |