|
GigaSpaces - Open Spaces | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GigaSpace
Provides a simpler interface of both JavaSpace
and GigaSpaces IJSpace
extension
utilizing GigaSpaces extended and simplified programming model.
Most operations revolve around the use of Objects allowing to use GigaSpaces support for POJOs.
JavaSpaces Entries can also be used. Space operations (at the end) are delegated to the relevant
operation of IJSpace
.
Though this interface has a single implementation it is still important to work against the interface as it allows for simpler testing and mocking.
Transaction management is implicit and works in a declarative manner. Operations do not accept a
transaction object, and will automatically use the TransactionProvider
in order to acquire
the current running transaction. If there is no current running transaction the operation will be
executed without a transaction.
IJSpace
can be acquired using getSpace()
and in conjunction with
getTxProvider()
allows to work directly with IJSpace
for low level API
execution or other low level GigaSpaces components requiring direct access to
IJSpace
.
Operations throw a DataAccessException
allowing for simplified
development model as it is a runtime exception. The cause of the exception can be acquired from
the GigaSpace exception.
IJSpace
,
Query
,
SQLQuery
,
TransactionProvider
,
DefaultGigaSpace
,
DataAccessException
Method Summary | ||
---|---|---|
void |
clean()
Cleans this space. |
|
void |
clear(Object template)
Removes the entries that match the specified template and the specified transaction from this space. |
|
int |
count(Object template)
Count any matching entry from the space. |
|
int |
count(Object template,
int modifiers)
Count any matching entry from the space. |
|
net.jini.core.transaction.Transaction |
getCurrentTransaction()
Returns the current running transaction. |
|
ExceptionTranslator |
getExceptionTranslator()
Returns the exception translator associated with this GigaSpace instnace. |
|
int |
getModifiersForIsolationLevel()
Gets the isolation level from the current running transaction (enabling the usage of Spring declarative isolation level settings). |
|
com.j_spaces.core.IJSpace |
getSpace()
Returns the IJSpace used by this GigaSpace implementation to delegate
different space operations. |
|
TransactionProvider |
getTxProvider()
Returns the transaction provider allowing to access the current running transaction. |
|
IteratorBuilder |
iterator()
Returns an iterator builder allowing to configure and create a GSIterator
over the Space. |
|
|
read(com.j_spaces.core.client.Query<T> template)
Read any matching object from the space, blocking until one exists. |
|
|
read(com.j_spaces.core.client.Query<T> template,
long timeout)
Read any matching object from the space, blocking until one exists. |
|
|
read(com.j_spaces.core.client.Query<T> template,
long timeout,
int modifiers)
Read any matching object from the space, blocking until one exists. |
|
|
read(T template)
Read any matching object from the space, blocking until one exists. |
|
|
read(T template,
long timeout)
Read any matching object from the space, blocking until one exists. |
|
|
read(T template,
long timeout,
int modifiers)
Read any matching object from the space, blocking until one exists. |
|
|
readIfExists(com.j_spaces.core.client.Query<T> template)
Read any matching object from the space, returning null if
there currently is none. |
|
|
readIfExists(com.j_spaces.core.client.Query<T> template,
long timeout)
Read any matching object from the space, returning null if
there currently is none. |
|
|
readIfExists(com.j_spaces.core.client.Query<T> template,
long timeout,
int modifiers)
Read any matching object from the space, returning null if
there currently is none. |
|
|
readIfExists(T template)
Read any matching object from the space, returning null if
there currently is none. |
|
|
readIfExists(T template,
long timeout)
Read any matching object from the space, returning null if
there currently is none. |
|
|
readIfExists(T template,
long timeout,
int modifiers)
Read any matching object from the space, returning null if
there currently is none. |
|
|
readMultiple(com.j_spaces.core.client.Query<T> template,
int maxEntries)
Read any matching entries from the space. |
|
|
readMultiple(com.j_spaces.core.client.Query<T> template,
int maxEntries,
int modifiers)
Read any matching entries from the space. |
|
|
readMultiple(T template,
int maxEntries)
Read any matching entries from the space. |
|
|
readMultiple(T template,
int maxEntries,
int modifiers)
Read any matching entries from the space. |
|
Object |
snapshot(Object entry)
The process of serializing an entry for transmission to a JavaSpaces service will be identical if the same entry is used twice. |
|
|
take(com.j_spaces.core.client.Query<T> template)
Take (remove) any matching entry from the space, blocking until one exists. |
|
|
take(com.j_spaces.core.client.Query<T> template,
long timeout)
Take (remove) any matching entry from the space, blocking until one exists. |
|
|
take(T template)
Take (remove) any matching entry from the space, blocking until one exists. |
|
|
take(T template,
long timeout)
Take (remove) any matching entry from the space, blocking until one exists. |
|
|
takeIfExists(com.j_spaces.core.client.Query<T> template)
Take (remove) any matching entry from the space, blocking until one exists. |
|
|
takeIfExists(com.j_spaces.core.client.Query<T> template,
long timeout)
Take (remove) any matching entry from the space, blocking until one exists. |
|
|
takeIfExists(T template)
Take (remove) any matching entry from the space, blocking until one exists. |
|
|
takeIfExists(T template,
long timeout)
Take (remove) any matching entry from the space, blocking until one exists. |
|
|
takeMultiple(com.j_spaces.core.client.Query<T> template,
int maxEntries)
Takes (removes) all the entries matching the specified template from this space. |
|
|
takeMultiple(T template,
int maxEntries)
Takes (removes) all the entries matching the specified template from this space. |
|
|
updateMultiple(T[] entries,
long[] leases)
|
|
|
updateMultiple(T[] entries,
long[] leases,
int updateModifiers)
Same as a single update but for a group of entities sharing the same transaction (if any), applied with the same operation modifier (or default Modifiers.NONE ). |
|
|
write(T entry)
Writes a new object to the space, returning its LeaseContext . |
|
|
write(T entry,
long lease)
Writes a new object to the space, returning its LeaseContext . |
|
|
write(T entry,
long lease,
long timeout,
int modifiers)
Writes a new object to the space, returning its LeaseContext . |
|
|
writeMultiple(T[] entries)
Writes the specified entries to this space. |
|
|
writeMultiple(T[] entries,
long lease)
Writes the specified entries to this space. |
Method Detail |
---|
com.j_spaces.core.IJSpace getSpace()
IJSpace
used by this GigaSpace implementation to delegate
different space operations.
Allows to execute space operations that are not exposed by this interface, as well as using it as a parameter to other low level GigaSpace components.
If a transaction object is required for low level operations (as low level operations do not
have declarative transaction ex) the getTxProvider()
should be used to acquire the
current running transaction.
TransactionProvider getTxProvider()
IJSpace
operations that requires explicit
transaction object.
net.jini.core.transaction.Transaction getCurrentTransaction()
null
if no transaction is in progress.
ExceptionTranslator getExceptionTranslator()
int getModifiersForIsolationLevel()
TransactionDefinition.ISOLATION_DEFAULT
will use the
default isolation level associated with this class.
void clean() throws DataAccessException
DataAccessException
IServerAdmin.clean()
void clear(Object template) throws DataAccessException
If the clear operation conducted without transaction (null as value) it will clear all entries that are not under transaction. Therefore entries under transaction would not be removed from the space.
The clear operation supports inheritance, therefore template class matching objects
and its sub classes matching objects are part of the candidates population
to be removed from the space. You can in fact clean all space objects (that are not under
transaction) by calling: gigaSpace.clear(null)
.
Notice: The clear operation does not remove notify templates i.e. registration for notifications.
template
- the template to use for matching
DataAccessException
IPojoSpace.clear(Object,net.jini.core.transaction.Transaction)
int count(Object template) throws DataAccessException
template
- The template used for matching. Matching is done against the
template with null
fields being wildcards
("match anything") other fields being values ("match
exactly on the serialized form").
DataAccessException
IPojoSpace.count(Object,net.jini.core.transaction.Transaction)
int count(Object template, int modifiers) throws DataAccessException
Allows to specify modifiers using ReadModifiers
which allows to programmatically control the isolation level this count operation
will be performed under.
template
- The template used for matching. Matching is done against the
template with null
fields being wildcards
("match anything") other fields being values ("match
exactly on the serialized form").modifiers
- one or a union of ReadModifiers
.
DataAccessException
Object snapshot(Object entry) throws DataAccessException
The process of serializing an entry for transmission to a JavaSpaces service will
be identical if the same entry is used twice. This is most likely to be an issue with
templates that are used repeatedly to search for entries with read or take. The client-side
implementations of read and take cannot reasonably avoid this duplicated effort, since they
have no efficient way of checking whether the same template is being used without intervening
modification. The snapshot method gives the JavaSpaces service implementor a way to reduce
the impact of repeated use of the same entry. Invoking snapshot with an Entry will return
another Entry object that contains a snapshot of the original entry. Using the returned snapshot
entry is equivalent to using the unmodified original entry in all operations on the same JavaSpaces
service. Modifications to the original entry will not affect the snapshot. You can snapshot a null
template; snapshot may or may not return null given a null template. The entry returned from snapshot
will be guaranteed equivalent to the original unmodified object only when used with the space. Using
the snapshot with any other JavaSpaces service will generate an IllegalArgumentException
unless the
other space can use it because of knowledge about the JavaSpaces service that generated the snapshot.
The snapshot will be a different object from the original, may or may not have the same hash code,
and equals may or may not return true when invoked with the original object, even if the original object
is unmodified. A snapshot is guaranteed to work only within the virtual machine in which it was generated.
If a snapshot is passed to another virtual machine (for example, in a parameter of an RMI call), using
it--even with the same JavaSpaces service--may generate an IllegalArgumentException
.
entry
- The entry to snapshot
DataAccessException
IPojoSpace.snapshot(Object)
<T> T read(T template) throws DataAccessException
null
if the timeout expires.
Note, the timeout is the default timeout this interface is configured with
(using its factory) and defaults to JavaSpace.NO_WAIT
.
template
- The template used for matching. Matching is done against
template with null
fields being
wildcards ("match anything") other fields being values ("match
exactly on the serialized form").
DataAccessException
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)
<T> T read(T template, long timeout) throws DataAccessException
null
if the timeout expires.
template
- The template used for matching. Matching is done against
template with null
fields being
wildcards ("match anything") other fields being values ("match
exactly on the serialized form").timeout
- How long the client is willing to wait for a
transactionally proper matching object. A timeout of
JavaSpace.NO_WAIT
means to wait no time at all; this is
equivalent to a wait of zero.
DataAccessException
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)
<T> T read(T template, long timeout, int modifiers) throws DataAccessException
null
if the timeout expires.
Overloads read(Object,long)
by adding a modifiers
parameter.
Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ
.
Modifiers are used to define the behavior of a read operation.
template
- The template used for matching. Matching is done against
template with null
fields being
wildcards ("match anything") other fields being values ("match
exactly on the serialized form").timeout
- How long the client is willing to wait for a
transactionally proper matching object. A timeout of
JavaSpace.NO_WAIT
means to wait no time at all; this is
equivalent to a wait of zero.modifiers
- one or a union of ReadModifiers
.
DataAccessException
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long,int)
<T> T read(com.j_spaces.core.client.Query<T> template) throws DataAccessException
null
if the timeout expires.
Note, the timeout is the default timeout this interface is configured with
(using its factory) and defaults to JavaSpace.NO_WAIT
.
template
- A query to be executed against the space. Most common one is
SQLQuery
.
DataAccessException
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)
<T> T read(com.j_spaces.core.client.Query<T> template, long timeout) throws DataAccessException
null
if the timeout expires.
template
- A query to be executed against the space. Most common one is
SQLQuery
.timeout
- How long the client is willing to wait for a
transactionally proper matching object. A timeout of
JavaSpace.NO_WAIT
means to wait no time at all; this is
equivalent to a wait of zero.
DataAccessException
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long)
<T> T read(com.j_spaces.core.client.Query<T> template, long timeout, int modifiers) throws DataAccessException
null
if the timeout expires.
Overloads read(Object,long)
by adding a modifiers
parameter.
Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ
.
Modifiers are used to define the behavior of a read operation.
template
- A query to be executed against the space. Most common one is
SQLQuery
.timeout
- How long the client is willing to wait for a
transactionally proper matching object. A timeout of
JavaSpace.NO_WAIT
means to wait no time at all; this is
equivalent to a wait of zero.modifiers
- one or a union of ReadModifiers
.
DataAccessException
IPojoSpace.read(Object,net.jini.core.transaction.Transaction,long,int)
<T> T readIfExists(T template) throws DataAccessException
null
if
there currently is none. Matching and timeouts are done as in
read
, except that blocking in this call is done only if
necessary to wait for transactional state to settle.
Note, the timeout is the default timeout this interface is configured with
(using its factory) and defaults to JavaSpace.NO_WAIT
.
template
- The template used for matching. Matching is done against
the template with null
fields being
wildcards ("match anything") other fields being values ("match
exactly on the serialized form").
DataAccessException
IPojoSpace.readIfExists(Object,net.jini.core.transaction.Transaction,long)
<T> T readIfExists(T template, long timeout) throws DataAccessException
null
if
there currently is none. Matching and timeouts are done as in
read
, except that blocking in this call is done only if
necessary to wait for transactional state to settle.
template
- The template used for matching. Matching is done against
template with null
fields being
wildcards ("match anything") other fields being values ("match
exactly on the serialized form").timeout
- How long the client is willing to wait for a
transactionally proper matching object. A timeout of
JavaSpace.NO_WAIT
means to wait no time at all; this is
equivalent to a wait of zero.
DataAccessException
IPojoSpace.readIfExists(Object,net.jini.core.transaction.Transaction,long)
<T> T readIfExists(T template, long timeout, int modifiers) throws DataAccessException
null
if
there currently is none. Matching and timeouts are done as in
read
, except that blocking in this call is done only if
necessary to wait for transactional state to settle.
Overloads read(Object,long)
by adding a modifiers
parameter.
Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ
.
Modifiers are used to define the behavior of a read operation.
template
- The template used for matching. Matching is done against
template with null
fields being
wildcards ("match anything") other fields being values ("match
exactly on the serialized form").timeout
- How long the client is willing to wait for a
transactionally proper matching object. A timeout of
JavaSpace.NO_WAIT
means to wait no time at all; this is
equivalent to a wait of zero.modifiers
- one or a union of ReadModifiers
.
DataAccessException
IJSpace.readIfExists(net.jini.core.entry.Entry,net.jini.core.transaction.Transaction,long,int)
<T> T readIfExists(com.j_spaces.core.client.Query<T> template) throws DataAccessException
null
if
there currently is none. Matching and timeouts are done as in
read
, except that blocking in this call is done only if
necessary to wait for transactional state to settle.
Note, the timeout is the default timeout this interface is configured with
(using its factory) and defaults to JavaSpace.NO_WAIT
.
template
- A query to be executed against the space. Most common one is
SQLQuery
.
DataAccessException
IPojoSpace.readIfExists(Object,net.jini.core.transaction.Transaction,long)
<T> T readIfExists(com.j_spaces.core.client.Query<T> template, long timeout) throws DataAccessException
null
if
there currently is none. Matching and timeouts are done as in
read
, except that blocking in this call is done only if
necessary to wait for transactional state to settle.
template
- A query to be executed against the space. Most common one is
SQLQuery
.timeout
- How long the client is willing to wait for a
transactionally proper matching object. A timeout of
JavaSpace.NO_WAIT
means to wait no time at all; this is
equivalent to a wait of zero.
DataAccessException
IPojoSpace.readIfExists(Object,net.jini.core.transaction.Transaction,long)
<T> T readIfExists(com.j_spaces.core.client.Query<T> template, long timeout, int modifiers) throws DataAccessException
null
if
there currently is none. Matching and timeouts are done as in
read
, except that blocking in this call is done only if
necessary to wait for transactional state to settle.
Overloads read(Object,long)
by adding a modifiers
parameter.
Equivalent when called with the default modifier - ReadModifiers.REPEATABLE_READ
.
Modifiers are used to define the behavior of a read operation.
template
- A query to be executed against the space. Most common one is
SQLQuery
.timeout
- How long the client is willing to wait for a
transactionally proper matching object. A timeout of
JavaSpace.NO_WAIT
means to wait no time at all; this is
equivalent to a wait of zero.modifiers
- one or a union of ReadModifiers
.
DataAccessException
IJSpace.readIfExists(net.jini.core.entry.Entry,net.jini.core.transaction.Transaction,long,int)
<T> T[] readMultiple(T template, int maxEntries) throws DataAccessException
read
without timeout (JavaSpace.NO_WAIT
). Returns an
array with matches bound by maxEntries
. Returns an
empty array if no match was found.
template
- The template used for matching. Matching is done against
the template with null
fields being.
wildcards ("match anything") other fields being values ("match
exactly on the serialized form"). The template can also be one
of the different Query
classesmaxEntries
- A limit on the number of entries to be returned. Use
Integer.MAX_VALUE
for the uppermost limit.
DataAccessException
IPojoSpace.readMultiple(Object,net.jini.core.transaction.Transaction,int)
<T> T[] readMultiple(com.j_spaces.core.client.Query<T> template, int maxEntries) throws DataAccessException
read
without timeout (JavaSpace.NO_WAIT
). Returns an
array with matches bound by maxEntries
. Returns an
empty array if no match was found.
template
- The template used for matching. Matching is done against
the template with null
fields being.
wildcards ("match anything") other fields being values ("match
exactly on the serialized form"). The template can also be one
of the different Query
classesmaxEntries
- A limit on the number of entries to be returned. Use
Integer.MAX_VALUE
for the uppermost limit.
DataAccessException
IPojoSpace.readMultiple(Object,net.jini.core.transaction.Transaction,int)
<T> T[] readMultiple(T template, int maxEntries, int modifiers) throws DataAccessException
read
without timeout (JavaSpace.NO_WAIT
). Returns an
array with matches bound by maxEntries
. Returns an
empty array if no match was found.
Overloads readMultiple(Object,int)
by adding a
modifiers
parameter. Equivalent when called with the default
modifier - ReadModifiers.REPEATABLE_READ
. Modifiers
are used to define the behavior of a read operation.
template
- The template used for matching. Matching is done against
the template with null
fields being.
wildcards ("match anything") other fields being values ("match
exactly on the serialized form"). The template can also be one
of the different Query
classesmaxEntries
- A limit on the number of entries to be returned. Use
Integer.MAX_VALUE
for the uppermost limit.modifiers
- One or a union of ReadModifiers
.
DataAccessException
IPojoSpace.readMultiple(Object,net.jini.core.transaction.Transaction,int)
<T> T[] readMultiple(com.j_spaces.core.client.Query<T> template, int maxEntries, int modifiers) throws DataAccessException
read
without timeout (JavaSpace.NO_WAIT
). Returns an
array with matches bound by maxEntries
. Returns an
empty array if no match was found.
Overloads readMultiple(Object,int)
by adding a
modifiers
parameter. Equivalent when called with the default
modifier - ReadModifiers.REPEATABLE_READ
. Modifiers
are used to define the behavior of a read operation.
template
- The template used for matching. Matching is done against
the template with null
fields being.
wildcards ("match anything") other fields being values ("match
exactly on the serialized form"). The template can also be one
of the different Query
classesmaxEntries
- A limit on the number of entries to be returned. Use
Integer.MAX_VALUE
for the uppermost limit.modifiers
- One or a union of ReadModifiers
.
DataAccessException
IPojoSpace.readMultiple(Object,net.jini.core.transaction.Transaction,int)
<T> T take(T template) throws DataAccessException
null
if the timeout expires.
Note, the timeout is the default timeout this interface is configured with
(using its factory) and defaults to JavaSpace.NO_WAIT
.
template
- The template used for matching. Matching is done against
the template with null
fields being wildcards (
"match anything") other fields being values ("match exactly
on the serialized form").
DataAccessException
<T> T take(T template, long timeout) throws DataAccessException
null
if the timeout expires.
template
- The template used for matching. Matching is done against
the template with null
fields being wildcards (
"match anything") other fields being values ("match exactly
on the serialized form").timeout
- How long the client is willing to wait for a
transactionally proper matching entry. A timeout of
JavaSpace.NO_WAIT
means to wait no
time at all; this is equivalent to a wait of zero.
DataAccessException
<T> T take(com.j_spaces.core.client.Query<T> template) throws DataAccessException
null
if the timeout expires.
Note, the timeout is the default timeout this interface is configured with
(using its factory) and defaults to JavaSpace.NO_WAIT
.
template
- A query to be executed against the space. Most common one is
SQLQuery
.
DataAccessException
<T> T take(com.j_spaces.core.client.Query<T> template, long timeout) throws DataAccessException
null
if the timeout expires.
template
- A query to be executed against the space. Most common one is
SQLQuery
.timeout
- How long the client is willing to wait for a
transactionally proper matching entry. A timeout of
JavaSpace.NO_WAIT
means to wait no
time at all; this is equivalent to a wait of zero.
DataAccessException
<T> T takeIfExists(T template) throws DataAccessException
null
if the timeout expires. Matching and timeouts are
done as in take
, except that blocking in this call is done
only if necessary to wait for transactional state to settle.
Note, the timeout is the default timeout this interface is configured with
(using its factory) and defaults to JavaSpace.NO_WAIT
.
template
- The template used for matching. Matching is done against
the template with null
fields being wildcards (
"match anything") other fields being values ("match exactly
on the serialized form").
DataAccessException
<T> T takeIfExists(T template, long timeout) throws DataAccessException
null
if the timeout expires. Matching and timeouts are
done as in take
, except that blocking in this call is done
only if necessary to wait for transactional state to settle.
template
- The template used for matching. Matching is done against
the template with null
fields being wildcards (
"match anything") other fields being values ("match exactly
on the serialized form").timeout
- How long the client is willing to wait for a
transactionally proper matching entry. A timeout of
JavaSpace.NO_WAIT
means to wait no
time at all; this is equivalent to a wait of zero.
DataAccessException
<T> T takeIfExists(com.j_spaces.core.client.Query<T> template) throws DataAccessException
null
if the timeout expires. Matching and timeouts are
done as in take
, except that blocking in this call is done
only if necessary to wait for transactional state to settle.
Note, the timeout is the default timeout this interface is configured with
(using its factory) and defaults to JavaSpace.NO_WAIT
.
template
- A query to be executed against the space. Most common one is
SQLQuery
.
DataAccessException
IPojoSpace.takeIfExists(Object,net.jini.core.transaction.Transaction,long)
<T> T takeIfExists(com.j_spaces.core.client.Query<T> template, long timeout) throws DataAccessException
null
if the timeout expires. Matching and timeouts are
done as in take
, except that blocking in this call is done
only if necessary to wait for transactional state to settle.
template
- A query to be executed against the space. Most common one is
SQLQuery
.timeout
- How long the client is willing to wait for a
transactionally proper matching entry. A timeout of
JavaSpace.NO_WAIT
means to wait no
time at all; this is equivalent to a wait of zero.
DataAccessException
IPojoSpace.takeIfExists(Object,net.jini.core.transaction.Transaction,long)
<T> T[] takeMultiple(T template, int maxEntries) throws DataAccessException
template
- The template used for matching. Matching is done against
the template with null
fields being.
wildcards ("match anything") other fields being values ("match
exactly on the serialized form"). The template can also be one
of the different Query
classesmaxEntries
- A limit on the number of entries to be returned. Use
Integer.MAX_VALUE
for the uppermost limit.
DataAccessException
IPojoSpace.takeMultiple(Object,net.jini.core.transaction.Transaction,int)
<T> T[] takeMultiple(com.j_spaces.core.client.Query<T> template, int maxEntries) throws DataAccessException
template
- The template used for matching. Matching is done against
the template with null
fields being.
wildcards ("match anything") other fields being values ("match
exactly on the serialized form"). The template can also be one
of the different Query
classesmaxEntries
- A limit on the number of entries to be returned. Use
Integer.MAX_VALUE
for the uppermost limit.
DataAccessException
IPojoSpace.takeMultiple(Object,net.jini.core.transaction.Transaction,int)
<T> com.j_spaces.core.LeaseContext<T> write(T entry) throws DataAccessException
LeaseContext
.
By default uses the UpdateModifiers.UPDATE_OR_WRITE
modifier (see write(Object,long,long,int)
. In order to force the operation
to perform "write" only (a bit more performant), the UpdateModifiers.WRITE_ONLY
modifier can be used resulting in an EntryAlreadyInSpaceException
if the entry already exists in the space (it must have an id for this exception to be raised).
If the object has a primary key that isn't auto - generated, and the modifiers value is one of
UpdateModifiers.UPDATE_OR_WRITE
,
UpdateModifiers.UPDATE_ONLY
or
UpdateModifiers.PARTIAL_UPDATE
, it will call to the update method,
returning a LeaseContext holder. This lease is unknown to the grantor, unless an actual 'write' was performed.
The entry will be written using the default lease this interface is configured with
(using the its factory). In order to explicitly define the lease, please use
write(Object,long)
.
entry
- The entry to write to the space
Lease
on a successful write, or null
if performed
with the proxy configured with NoWriteLease flag.
when UpdateModifiers.UPDATE_OR_WRITE
modifier is applied,
LeaseContext.getObject()
returns null
on a successful write
or the previous value - on successful update. UpdateOperationTimeoutException
is thrown if timeout occurred while trying to update the object.
DataAccessException
IPojoSpace.write(Object,net.jini.core.transaction.Transaction,long)
<T> com.j_spaces.core.LeaseContext<T> write(T entry, long lease) throws DataAccessException
LeaseContext
.
By default uses the UpdateModifiers.UPDATE_OR_WRITE
modifier (see write(Object,long,long,int)
. In order to force the operation
to perform "write" only (a bit more performant), the UpdateModifiers.WRITE_ONLY
modifier can be used resulting in an EntryAlreadyInSpaceException
if the entry already exists in the space (it must have an id for this exception to be raised).
If the object has a primary key that isn't auto - generated, and the modifiers value is one of
UpdateModifiers.UPDATE_OR_WRITE
,
UpdateModifiers.UPDATE_ONLY
or
UpdateModifiers.PARTIAL_UPDATE
, it will call to the update method,
returning a LeaseContext holder. This lease is unknown to the grantor, unless an actual 'write' was performed.
entry
- The entry to write to the spacelease
- The lease the entry will be written with, in milliseconds.
Lease
on a successful write, or null
if performed
with the proxy configured with NoWriteLease flag.
when UpdateModifiers.UPDATE_OR_WRITE
modifier is applied,
LeaseContext.getObject()
returns null
on a successful write
or the previous value - on successful update. UpdateOperationTimeoutException
is thrown if timeout occurred while trying to update the object.
DataAccessException
IPojoSpace.write(Object,net.jini.core.transaction.Transaction,long)
<T> com.j_spaces.core.LeaseContext<T> write(T entry, long lease, long timeout, int modifiers) throws DataAccessException
LeaseContext
.
By default uses the UpdateModifiers.UPDATE_OR_WRITE
modifier (see write(Object,long,long,int)
. In order to force the operation
to perform "write" only (a bit more performant), the UpdateModifiers.WRITE_ONLY
modifier can be used resulting in an EntryAlreadyInSpaceException
if the entry already exists in the space (it must have an id for this exception to be raised).
If the object has a primary key that isn't auto - generated, and the modifiers value is one of
UpdateModifiers.UPDATE_OR_WRITE
,
UpdateModifiers.UPDATE_ONLY
or
UpdateModifiers.PARTIAL_UPDATE
, it will call to the update method,
returning a LeaseContext holder. This lease is unknown to the grantor, unless an actual 'write' was performed.
entry
- The entry to write to the spacelease
- The lease the entry will be written with, in milliseconds.
Lease
on a successful write, or null
if performed
with the proxy configured with NoWriteLease flag.
when UpdateModifiers.UPDATE_OR_WRITE
modifier is applied,
LeaseContext.getObject()
returns null
on a successful write
or the previous value - on successful update. UpdateOperationTimeoutException
is thrown if timeout occurred while trying to update the object.
DataAccessException
IPojoSpace.write(Object,net.jini.core.transaction.Transaction,long)
<T> com.j_spaces.core.LeaseContext<T>[] writeMultiple(T[] entries) throws DataAccessException
The entry will be written using the default lease this interface is configured with
(using the its factory). In order to explicitly define the lease, please use
writeMultiple(Object[],long)
.
entries
- The entries to write to the space.
DataAccessException
IPojoSpace.writeMultiple(Object[],net.jini.core.transaction.Transaction,long)
<T> com.j_spaces.core.LeaseContext<T>[] writeMultiple(T[] entries, long lease) throws DataAccessException
entries
- The entries to write to the space.lease
- The lease the entry will be written with, in milliseconds.
DataAccessException
IPojoSpace.writeMultiple(Object[],net.jini.core.transaction.Transaction,long)
<T> Object[] updateMultiple(T[] entries, long[] leases) throws DataAccessException
DataAccessException
<T> Object[] updateMultiple(T[] entries, long[] leases, int updateModifiers) throws DataAccessException
Modifiers.NONE
).
The semantics of a single update and a batch update are similar - the return
value for each corresponds to it's cell in the returned array.
see 'returns'
for possible return values.
entries
- the array of objects containing the new values,
each entry must contain its UID.leases
- The lease time of the updated objects, 0 means retain the original lease.updateModifiers
- operation modifiers, values from UpdateModifiers
.
null
- if timeout occurred after waiting for a transactional proper matching entry
EntryNotInSpaceException
- in case the entry does not exist
SpaceOptimisticLockingFailureException
- in case updating with non-latest version
UpdateModifiers.UPDATE_OR_WRITE
modifier is applied,
null
- if write was successful,
DataAccessException
IteratorBuilder iterator()
GSIterator
over the Space.
|
GigaSpaces - Open Spaces | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |