|
GigaSpaces XAP 7.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openspaces.core.GigaSpaceFactoryBean
public class GigaSpaceFactoryBean
A factory bean creating GigaSpace
implementation.
The implementation created is DefaultGigaSpace
which
allows for pluggable IJSpace
,
TransactionProvider
, and
ExceptionTranslator
.
The factory requires an IJSpace
which can be either
directly acquired or build using one of the several space factory beans provided in
org.openspaces.core.space
.
The factory accepts an optional TransactionProvider
which defaults to DefaultTransactionProvider
.
The transactional context used is based on
setTransactionManager(org.springframework.transaction.PlatformTransactionManager)
and if no transaction manager is provided, will use the space as the context.
When using LocalJiniTransactionManager
there is no need
to pass the transaction manager to this factory, since both by default will use the space as the
transactional context. When working with LookupJiniTransactionManager
(which probably means Mahalo and support for more than one space as transaction resources) the transaction
manager should be provided to this class.
The factory accepts an optional ExceptionTranslator
which defaults to DefaultExceptionTranslator
.
A clustered flag allows to control if this GigaSpace instance will work against a clustered view of
the space or directly against a clustered member. This flag has no affect when not working in a
clustered mode (partitioned or primary/backup). By default if this flag is not set it will be set
automatically by this factory. It will be set to true
if the space is an embedded one AND
the space is not a local cache proxy. It will be set to false
otherwise (i.e. the space
is not an embedded space OR the space is a local cache proxy). A local cache proxy is an IJSpace
that is injected using setSpace(com.j_spaces.core.IJSpace)
and was created using either
LocalViewSpaceFactoryBean
or
LocalCacheSpaceFactoryBean
.
The factory allows to set the default read/take timeout and write lease when using the same operations without the relevant parameters.
The factory also allows to set the default isolation level for read operations that will
be performed by GigaSpace
API. The isolation level can be set
either using setDefaultIsolationLevel(int)
or setDefaultIsolationLevelName(String)
.
Note, this setting will apply when not working under Spring declarative transactions or when using
Spring declarative transaction with the default isolation level
(TransactionDefinition.ISOLATION_DEFAULT
).
GigaSpace
,
DefaultGigaSpace
,
TransactionProvider
,
ExceptionTranslator
,
AbstractJiniTransactionManager
Field Summary | |
---|---|
static String |
PREFIX_ISOLATION
Prefix for the isolation constants defined in TransactionDefinition |
Constructor Summary | |
---|---|
GigaSpaceFactoryBean()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Constructs the GigaSpace instance using the
DefaultGigaSpace implementation. |
Object |
getObject()
Return GigaSpace implementation constructed in
the afterPropertiesSet() phase. |
Class<? extends GigaSpace> |
getObjectType()
|
boolean |
isSingleton()
Returns true as this is a singleton. |
void |
setBeanName(String beanName)
|
void |
setClustered(boolean clustered)
Sets the cluster flag controlling if this GigaSpace will work with a clustered
view of the space or directly with a cluster member. |
void |
setDefaultIsolationLevel(int defaultIsolationLevel)
Set the default isolation level. |
void |
setDefaultIsolationLevelName(String constantName)
Set the default isolation level by the name of the corresponding constant in TransactionDefinition, e.g. |
void |
setDefaultReadTimeout(long defaultReadTimeout)
Sets the default read timeout for GigaSpace.read(Object) and
GigaSpace.readIfExists(Object) operations. |
void |
setDefaultTakeTimeout(long defaultTakeTimeout)
Sets the default take timeout for GigaSpace.take(Object) and
GigaSpace.takeIfExists(Object) operations. |
void |
setDefaultWriteLease(long defaultWriteLease)
Sets the default write lease for GigaSpace.write(Object) operation. |
void |
setExTranslator(ExceptionTranslator exTranslator)
Sets the exception translator that will be used by the created GigaSpace . |
void |
setSpace(IJSpace space)
Sets the space that will be used by the created GigaSpace . |
void |
setTransactionManager(PlatformTransactionManager transactionManager)
Set the transaction manager to enable transactional operations. |
void |
setTxProvider(TransactionProvider txProvider)
Sets the transaction provider that will be used by the created GigaSpace . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PREFIX_ISOLATION
Constructor Detail |
---|
public GigaSpaceFactoryBean()
Method Detail |
---|
public void setSpace(IJSpace space)
Sets the space that will be used by the created GigaSpace
.
This is a required parameter to the factory.
space
- The space usedpublic void setTxProvider(TransactionProvider txProvider)
Sets the transaction provider that will be used by the created GigaSpace
.
This is an optional parameter and defaults to DefaultTransactionProvider
.
txProvider
- The transaction provider to usepublic void setExTranslator(ExceptionTranslator exTranslator)
Sets the exception translator that will be used by the created GigaSpace
.
This is an optional parameter and defaults to DefaultExceptionTranslator
.
exTranslator
- The exception translator to usepublic void setClustered(boolean clustered)
Sets the cluster flag controlling if this GigaSpace
will work with a clustered
view of the space or directly with a cluster member. By default if this flag is not set it will be set
automatically by this factory. It will be set to true
if the space is an embedded one AND
the space is not a local cache proxy. It will be set to false
otherwise (i.e. the space
is not an embedded space OR the space is a local cache proxy).
clustered
- If the GigaSpace
is going to work with a clustered view of the
space or directly with a cluster memberpublic void setDefaultReadTimeout(long defaultReadTimeout)
Sets the default read timeout for GigaSpace.read(Object)
and
GigaSpace.readIfExists(Object)
operations. Default to
JavaSpace.NO_WAIT
.
public void setDefaultTakeTimeout(long defaultTakeTimeout)
Sets the default take timeout for GigaSpace.take(Object)
and
GigaSpace.takeIfExists(Object)
operations. Default to
JavaSpace.NO_WAIT
.
public void setDefaultWriteLease(long defaultWriteLease)
Sets the default write lease for GigaSpace.write(Object)
operation.
Default to Lease.FOREVER
.
public final void setDefaultIsolationLevelName(String constantName) throws IllegalArgumentException
constantName
- name of the constant
IllegalArgumentException
- if the supplied value is not resolvable
to one of the ISOLATION_
constants or is null
setDefaultIsolationLevel(int)
,
TransactionDefinition.ISOLATION_DEFAULT
public void setDefaultIsolationLevel(int defaultIsolationLevel)
IllegalArgumentException
- if the supplied value is not
one of the ISOLATION_
constantsTransactionDefinition.ISOLATION_DEFAULT
public void setTransactionManager(PlatformTransactionManager transactionManager)
Set the transaction manager to enable transactional operations. Can be null
if transactional support is not required or the default space is used as a transactional context.
public void setBeanName(String beanName)
setBeanName
in interface BeanNameAware
public void afterPropertiesSet()
GigaSpace
instance using the
DefaultGigaSpace
implementation. Uses the clustered flag to
get a cluster member directly (if set to false
) and applies the different
defaults).
afterPropertiesSet
in interface InitializingBean
public Object getObject()
GigaSpace
implementation constructed in
the afterPropertiesSet()
phase.
getObject
in interface FactoryBean
public Class<? extends GigaSpace> getObjectType()
getObjectType
in interface FactoryBean
public boolean isSingleton()
true
as this is a singleton.
isSingleton
in interface FactoryBean
|
GigaSpaces XAP 7.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |